// File: /workspace/github_cpp_makefile_star2_O3/Baobaobear[P]sort/sorttest.cpp
// Function: main
int main(void)
{
    time_point t;

    std::map<int, gen_data_func_t> gen_data_fun_map;
    std::map<int, arrar_function_t> gen_data_shuffle;
    std::map<std::string, arrar_function_t> test_func_map;
    std::map<int, int> split_size_map;
    const size_t out_bound_check_size = 128;
    const int out_bound_check_head_value = 0xf0f0f0f;
    const int out_bound_check_tail_value = -0xf0f0f0f;

    init_gen_data_fun_map(gen_data_fun_map, gen_data_shuffle, split_size_map);
    init_test_func_map(test_func_map);

    int base_size = 1000;
    if (TEST_TYPE_SIMPLE)
    {
        base_size += base_size / 2;
    }
    int arr_size = base_size * base_size * 2;
    std::vector<sort_element_t> arr(arr_size + out_bound_check_size * 2);
    baobao::util::rand_seed((uint32_t)time(NULL));

#if CONSOLE_OUTPUT == 1
    printf("Begin %d\n", arr_size);

    printf(" -|");
    for (std::map<std::string, arrar_function_t>::iterator it = test_func_map.begin();
         it != test_func_map.end();
         ++it)
    {
        printf("%12s|", it->first.c_str());
    }
    puts("");
    printf("-:|");
    for (std::map<std::string, arrar_function_t>::iterator it = test_func_map.begin();
         it != test_func_map.end();
         ++it)
    {
        printf("%12s|", "-----------:");
    }
    puts("");
#endif
    std::map<std::string, std::map<int, int> > result_map;
    std::map<std::string, int > unstable_map;
    for (std::map<int, gen_data_func_t>::iterator it_test = gen_data_fun_map.begin();
         it_test != gen_data_fun_map.end();
         ++it_test)
    {
        if (CONSOLE_OUTPUT)
            printf("%2d|", it_test->first);
        for (size_t i = 0; i < out_bound_check_size; ++i)
        {
            arr[i] = out_bound_check_head_value;
            arr[arr.size() - out_bound_check_size + i] = out_bound_check_tail_value;
        }
        for (int i = 0; i < (int)arr_size; ++i)
        {
            arr[i + out_bound_check_size] = it_test->second(i, arr_size);
        }
        if (gen_data_shuffle.find(it_test->first) != gen_data_shuffle.end())
        {
            gen_data_shuffle[it_test->first](&*(arr.begin() + out_bound_check_size), arr_size);
        }
#if TEST_TYPE_SIMPLE == 0
        for (int i = 0; i < (int)arr_size; ++i)
        {
            arr[i + out_bound_check_size].index = i;
        }
#endif
        for (std::map<std::string, arrar_function_t>::iterator it = test_func_map.begin();
             it != test_func_map.end();
             ++it)
        {
            std::vector<sort_element_t> arr_c = arr;
            int res_ms = 0;
            bool correct = true;
            if (split_size_map.find(it_test->first) != split_size_map.end())
            {
                int split_cnt = split_size_map[it_test->first];
                int last_size = arr_size - split_cnt;
                std::vector<sort_element_t> arr_c2 = arr;
                t = get_time();
                for (int i = 0; i < last_size; i += split_cnt)
                {
                    it->second(&*arr_c.begin() + out_bound_check_size + i, split_cnt);
                }
                for (int i = 0; i < last_size; i += split_cnt)
                {
                    it->second(&*arr_c2.begin() + out_bound_check_size + i, split_cnt);
                }
                res_ms = (int)get_time_diff(t, get_time());

                //for (size_t i = 0; i < arr_size; i++) // avoid optimize arr_c2
                //{
                //    if (arr_c[i] < arr_c2[i] || arr_c2[i] < arr_c[i])
                //    {
                //        correct = false;
                //    }
                //}
            }
            else
            {
                t = get_time();
                it->second(&*(arr_c.begin() + out_bound_check_size), arr_size);
                res_ms = (int)get_time_diff(t, get_time());
            }
            if (CONSOLE_OUTPUT)
                printf("%12d|", (int)res_ms);

            if (split_size_map.find(it_test->first) == split_size_map.end())
            {
                for (size_t i = 0; i < out_bound_check_size; ++i)
                {
                    if (!(arr[i] == out_bound_check_head_value))
                    {
                        correct = false;
                        break;
                    }
                    if (!(arr[arr.size() - out_bound_check_size + i] == out_bound_check_tail_value))
                    {
                        correct = false;
                        break;
                    }
                }
                if (correct)
                {
                    if (!baobao::check_sorted(arr_c.begin() + out_bound_check_size, arr_c.end() - out_bound_check_size, std::less<sort_element_t>()))
                    {
                        correct = false;
                    }
#if TEST_TYPE_SIMPLE == 0
                    else
                    {
                        if (!baobao::check_sorted_stable(arr_c.begin() + out_bound_check_size, arr_c.end() - out_bound_check_size, std::less<sort_element_t>()))
                        {
                            unstable_map[it->first] = 1;
                        }
                    }
#endif
                }
            }
            if (correct)
            {
                result_map[it->first][it_test->first] = res_ms;
            }
            else
            {
                result_map[it->first][it_test->first] = -1;
            }
            fflush(stdout);
        }
        if (CONSOLE_OUTPUT)
            printf("\n");
    }

    std::vector<std::string> index_name;
    std::vector<algo_score> final_score;

    for (std::map<std::string, arrar_function_t>::iterator it_test = test_func_map.begin();
         it_test != test_func_map.end();
         ++it_test)
    {
        index_name.push_back(it_test->first);
        final_score.push_back(algo_score(0, (int)index_name.size() - 1, it_test->first));
        for (std::map<int, gen_data_func_t>::iterator it = gen_data_fun_map.begin();
             it != gen_data_fun_map.end();
             ++it)
        {
            int v = result_map[it_test->first][it->first];
            if (v >= 0)
            {
                final_score.back().score += v;
            }
            else if (v == -1)
            {
                final_score.back().score += 1000 * 1000;
            }
        }
    }

#if TEST_TYPE_SIMPLE == 0
    printf("\n%-12s||\n------------|---\n", "stable test");
    for (std::map<std::string, arrar_function_t>::iterator it_test = test_func_map.begin();
        it_test != test_func_map.end();
        ++it_test)
    {
        printf("%-12s|%s\n", it_test->first.c_str(), (unstable_map.find(it_test->first) != unstable_map.end() ? "no" : "yes"));
    }
#endif

    char test_title[16] = "";
    if (TEST_TYPE_SIMPLE == 0)
    {
        sprintf(test_title, "TestClass %d", TEST_CLASS_SIZE);
    }
    else if (TEST_TYPE_SIMPLE == 1)
    {
        sprintf(test_title, "int");
    }
    else if (TEST_TYPE_SIMPLE == 2)
    {
        sprintf(test_title, "double");
    }
    else
    {
    }
    printf("\n%-12s|", test_title);
    for (std::map<int, gen_data_func_t>::iterator it = gen_data_fun_map.begin();
         it != gen_data_fun_map.end();
         ++it)
    {
        printf("  %-3d|", it->first);
    }
    puts(" Avg |");
    printf("------------|");
    for (std::map<int, gen_data_func_t>::iterator it = gen_data_fun_map.begin();
         it != gen_data_fun_map.end();
         ++it)
    {
        printf("%5s|", "----:");
    }
    puts("----:|");
    std::sort(final_score.begin(), final_score.end());
    for (std::vector<algo_score>::iterator it_test = final_score.begin();
         it_test != final_score.end();
         ++it_test)
    {
        std::string name = it_test->name;
        printf("%-12s|", name.c_str());
        for (std::map<int, gen_data_func_t>::iterator it = gen_data_fun_map.begin();
             it != gen_data_fun_map.end();
             ++it)
        {
            int v = result_map[name][it->first];
            if (v >= 0)
            {
                printf("%5d|", v);
            }
            else if (v == -1)
            {
                printf("%5s|", "Wrong");
            }
            else if (v == -2)
            {
                printf("%5s|", "Error");
            }
            else if (v == -3)
            {
                printf("%5s|", "Time");
            }
        }
        printf("%5d|\n", (int)(it_test->score / gen_data_fun_map.size()));
    }
    printf("\n%d END\n", arr_size);
    fflush(stdout);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
leaq 0xc0(%rsp), %rcx
xorl %eax, %eax
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq 0x158(%rsp), %rcx
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq 0x128(%rsp), %rcx
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq 0x198(%rsp), %r13
movl %eax, (%r13)
movq %rax, 0x8(%r13)
movq %r13, 0x10(%r13)
movq %r13, 0x18(%r13)
movq %rax, 0x20(%r13)
leaq 0x80(%rsp), %rsi
movl $0x1, (%rsi)
leaq 0xb8(%rsp), %rdi
callq 0x45b0
leaq 0xe7e(%rip), %rcx       # 0x3b40
movq %rcx, (%rax)
leaq 0x80(%rsp), %rsi
movl $0x2, (%rsi)
leaq 0xb8(%rsp), %rdi
callq 0x45b0
leaq 0xe5f(%rip), %rcx       # 0x3b46
movq %rcx, (%rax)
leaq 0x80(%rsp), %rsi
movl $0x3, (%rsi)
leaq 0xb8(%rsp), %rdi
callq 0x45b0
leaq 0xe40(%rip), %rcx       # 0x3b4c
movq %rcx, (%rax)
leaq 0x80(%rsp), %rsi
movl $0x4, (%rsi)
leaq 0xb8(%rsp), %rdi
callq 0x45b0
leaq 0xe26(%rip), %rbx       # 0x3b57
movq %rbx, (%rax)
leaq 0x80(%rsp), %rsi
movl $0x4, (%rsi)
leaq 0x150(%rsp), %rdi
callq 0x40a4
leaq 0xe04(%rip), %r14       # 0x3b5a
movq %r14, (%rax)
leaq 0x80(%rsp), %rsi
movl $0x5, (%rsi)
leaq 0xb8(%rsp), %rdi
callq 0x45b0
leaq 0xdeb(%rip), %rcx       # 0x3b66
movq %rcx, (%rax)
leaq 0x80(%rsp), %rsi
movl $0x5, (%rsi)
leaq 0x150(%rsp), %rdi
callq 0x40a4
movq %r14, (%rax)
leaq 0x80(%rsp), %rsi
movl $0x6, (%rsi)
leaq 0xb8(%rsp), %rdi
callq 0x45b0
leaq 0xdb9(%rip), %r15       # 0x3b77
movq %r15, (%rax)
leaq 0x80(%rsp), %rsi
movl $0x6, (%rsi)
leaq 0x150(%rsp), %rdi
callq 0x40a4
movq %r14, (%rax)
leaq 0x80(%rsp), %rsi
movl $0x7, (%rsi)
leaq 0xb8(%rsp), %rdi
callq 0x45b0
movq %r15, (%rax)
leaq 0x80(%rsp), %rsi
movl $0x8, (%rsi)
leaq 0xb8(%rsp), %rdi
callq 0x45b0
leaq 0xd68(%rip), %rcx       # 0x3b87
movq %rcx, (%rax)
leaq 0x80(%rsp), %rsi
movl $0x9, (%rsi)
leaq 0xb8(%rsp), %rdi
callq 0x45b0
movq %rbx, (%rax)
leaq 0x80(%rsp), %rsi
movl $0x9, (%rsi)
leaq 0x150(%rsp), %rdi
callq 0x40a4
leaq 0xd2b(%rip), %rcx       # 0x3b8d
movq %rcx, (%rax)
leaq 0x80(%rsp), %rsi
movl $0xa, (%rsi)
leaq 0xb8(%rsp), %rdi
callq 0x45b0
movq %rbx, (%rax)
leaq 0x80(%rsp), %rsi
movl $0xa, (%rsi)
leaq 0x150(%rsp), %rdi
callq 0x40a4
leaq 0xe4e(%rip), %rcx       # 0x3cf3
movq %rcx, (%rax)
leaq 0x80(%rsp), %rsi
movl $0xb, (%rsi)
leaq 0xb8(%rsp), %rdi
callq 0x45b0
movq %rbx, (%rax)
leaq 0x80(%rsp), %rsi
movl $0xb, (%rsi)
leaq 0x150(%rsp), %rdi
callq 0x40a4
movq %r14, (%rax)
leaq 0x80(%rsp), %rsi
movl $0xb, (%rsi)
leaq 0x190(%rsp), %rdi
callq 0x4198
movl $0x104, (%rax)          # imm = 0x104
leaq 0x120(%rsp), %rdi
callq 0x27a0
xorpd %xmm0, %xmm0
leaq 0x80(%rsp), %rdx
movapd %xmm0, 0x10(%rdx)
movapd %xmm0, (%rdx)
leaq 0xe8(%rsp), %rdi
leaq 0x1c0(%rsp), %rcx
movl $0x1e8580, %esi         # imm = 0x1E8580
callq 0x400c
xorl %edi, %edi
callq 0x2160
leaq 0x80(%rsp), %rdi
movl %eax, %esi
callq 0x4524
callq 0x3d4a
leaq 0x88(%rsp), %rcx
movl (%rcx), %edx
movl %edx, 0x8(%rax)
movq -0x8(%rcx), %rdx
movq %rdx, (%rax)
xorl %eax, %eax
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq 0x1c8(%rsp), %rcx
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
movq 0xd0(%rsp), %rax
movq %rax, 0x50(%rsp)
leaq 0xc0(%rsp), %rcx
cmpq %rcx, %rax
leaq 0x128(%rsp), %r14
je 0x34f0
leaq 0x30(%rsp), %r15
movq 0xe8(%rsp), %rax
movq 0xf0(%rsp), %rcx
movq $-0x1000, %rdx          # imm = 0xF000
addq %rdx, %rcx
xorl %edx, %edx
movl $0xf0f0f0f, (%rax,%rdx) # imm = 0xF0F0F0F
movl $0xf0f0f0f1, (%rcx,%rdx) # imm = 0xF0F0F0F1
addq $0x20, %rdx
cmpq $0x1000, %rdx           # imm = 0x1000
jne 0x2fe5
movl $0x1000, %ebx           # imm = 0x1000
xorl %r14d, %r14d
movl %r14d, %edi
movl $0x1e8480, %esi         # imm = 0x1E8480
movq 0x50(%rsp), %rax
callq *0x28(%rax)
movq 0xe8(%rsp), %rcx
movl %eax, (%rcx,%rbx)
incq %r14
addq $0x20, %rbx
cmpq $0x1e8480, %r14         # imm = 0x1E8480
jne 0x3008
movq 0x50(%rsp), %rax
leaq 0x20(%rax), %rbx
movq 0x160(%rsp), %rdi
testq %rdi, %rdi
leaq 0x128(%rsp), %r14
je 0x30bc
movl (%rbx), %eax
leaq 0x158(%rsp), %r8
movq %r8, %rcx
movq %rdi, %rdx
movl 0x20(%rdi), %esi
xorl %edi, %edi
cmpl %eax, %esi
setl %dil
movq %rdx, %r8
cmovlq %rcx, %r8
movq 0x10(%rdx,%rdi,8), %rdi
testq %rdi, %rdi
jne 0x305b
leaq 0x158(%rsp), %rdi
cmpq %rdi, %r8
je 0x30bc
cmpl %eax, %esi
cmovlq %rcx, %rdx
cmpl 0x20(%rdx), %eax
jl 0x30bc
leaq 0x150(%rsp), %rdi
movq %rbx, %rsi
callq 0x40a4
movq 0xe8(%rsp), %rdi
movl $0x1000, %ecx           # imm = 0x1000
addq %rcx, %rdi
movl $0x1e8480, %esi         # imm = 0x1E8480
callq *(%rax)
movq 0xe8(%rsp), %rax
movl $0x1004, %ecx           # imm = 0x1004
addq %rcx, %rax
xorl %ecx, %ecx
movl %ecx, (%rax)
incq %rcx
addq $0x20, %rax
cmpq $0x1e8480, %rcx         # imm = 0x1E8480
jne 0x30ce
movq 0x138(%rsp), %rbp
cmpq %r14, %rbp
movq %rbx, 0x188(%rsp)
je 0x34d0
leaq 0x58(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x4108
movq 0x1a0(%rsp), %rdi
testq %rdi, %rdi
je 0x3153
movl (%rbx), %eax
movq %r13, %r8
movq %r8, %rcx
movq %rdi, %rdx
movl 0x20(%rdi), %esi
xorl %edi, %edi
cmpl %eax, %esi
setl %dil
movq %rdx, %r8
cmovlq %rcx, %r8
movq 0x10(%rdx,%rdi,8), %rdi
testq %rdi, %rdi
jne 0x311d
cmpq %r13, %r8
je 0x3153
cmpl %eax, %esi
cmovlq %rcx, %rdx
cmpl 0x20(%rdx), %eax
jge 0x32d9
movq %r15, %rdi
xorl %esi, %esi
callq 0x2200
movq 0x30(%rsp), %rbx
movq %r15, %r12
movq 0x38(%rsp), %r15
movq 0x58(%rsp), %rdi
movl $0x1000, %eax           # imm = 0x1000
addq %rax, %rdi
movl $0x1e8480, %esi         # imm = 0x1E8480
callq *0x40(%rbp)
movq %r15, %rax
movabsq $0x20c49ba5e353f7cf, %r15 # imm = 0x20C49BA5E353F7CF
imulq %r15
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x7, %rdx
addq %rax, %rdx
imulq $0x3e8, %rbx, %rax      # imm = 0x3E8
addq %rdx, %rax
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x8(%rsp)
movq %r12, %rdi
xorl %esi, %esi
callq 0x2200
imulq $0x3e8, 0x30(%rsp), %rcx # imm = 0x3E8
movq %r15, %rax
imulq 0x38(%rsp)
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x7, %rdx
addq %rax, %rdx
addq %rcx, %rdx
xorps %xmm0, %xmm0
cvtsi2sd %rdx, %xmm0
subsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %r12, %r15
movq 0x1a0(%rsp), %rdi
testq %rdi, %rdi
movq 0x188(%rsp), %rbx
je 0x3245
movl (%rbx), %eax
movq %r13, %r8
movq %r8, %rcx
movq %rdi, %rdx
movl 0x20(%rdi), %esi
xorl %edi, %edi
cmpl %eax, %esi
setl %dil
movq %rdx, %r8
cmovlq %rcx, %r8
movq 0x10(%rdx,%rdi,8), %rdi
testq %rdi, %rdi
jne 0x320f
cmpq %r13, %r8
je 0x3245
cmpl %eax, %esi
cmovlq %rcx, %rdx
cmpl 0x20(%rdx), %eax
jge 0x347a
movq 0xe8(%rsp), %rax
movq 0xf0(%rsp), %rcx
movq $-0x1000, %rdx          # imm = 0xF000
addq %rdx, %rcx
xorl %edx, %edx
cmpl $0xf0f0f0f, (%rax,%rdx) # imm = 0xF0F0F0F
jne 0x32b2
cmpl $0xf0f0f0f1, (%rcx,%rdx) # imm = 0xF0F0F0F1
jne 0x32b2
addq $0x20, %rdx
cmpq $0x1000, %rdx           # imm = 0x1000
jne 0x3261
movq 0x58(%rsp), %rcx
movq 0x60(%rsp), %rax
movq $-0x1000, %rdx          # imm = 0xF000
addq %rdx, %rax
leaq 0x1020(%rcx), %rdx
cmpq %rax, %rdx
je 0x3426
movl (%rdx), %esi
leaq 0x20(%rdx), %rdi
cmpl -0x20(%rdx), %esi
movq %rdi, %rdx
jge 0x329b
leaq 0x20(%rbp), %rsi
leaq 0x80(%rsp), %rdi
callq 0x42d6
movq %rax, %rdi
movq %rbx, %rsi
callq 0x4198
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
jmp 0x349e
leaq 0x190(%rsp), %rdi
movq %rbx, %rsi
callq 0x4198
movslq (%rax), %r12
movq %r15, %rdi
leaq 0xe8(%rsp), %rsi
callq 0x4108
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
callq 0x2200
movabsq $0x20c49ba5e353f7cf, %rax # imm = 0x20C49BA5E353F7CF
imulq 0x18(%rsp)
movq %rdx, 0x8(%rsp)
imulq $0x3e8, 0x10(%rsp), %rax # imm = 0x3E8
movq %rax, 0x180(%rsp)
cmpl $0x1e847f, %r12d        # imm = 0x1E847F
jg 0x3396
movl $0x1e8480, %r13d        # imm = 0x1E8480
subq %r12, %r13
movq %r12, %rbx
shlq $0x5, %rbx
movl $0x1000, %r14d          # imm = 0x1000
xorl %r15d, %r15d
movq 0x58(%rsp), %rdi
addq %r14, %rdi
movq %r12, %rsi
callq *0x40(%rbp)
addq %r12, %r15
addq %rbx, %r14
cmpq %r13, %r15
jl 0x334f
cmpl $0x1e847f, %r12d        # imm = 0x1E847F
jg 0x3396
movslq %r13d, %r13
movl $0x1000, %r14d          # imm = 0x1000
xorl %r15d, %r15d
movq 0x30(%rsp), %rdi
addq %r14, %rdi
movq %r12, %rsi
callq *0x40(%rbp)
addq %r12, %r15
addq %rbx, %r14
cmpq %r13, %r15
jl 0x337d
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
callq 0x2200
imulq $0x3e8, 0x10(%rsp), %rbx # imm = 0x3E8
movabsq $0x20c49ba5e353f7cf, %rax # imm = 0x20C49BA5E353F7CF
imulq 0x18(%rsp)
movq %rdx, %r12
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x33cc
callq 0x2170
movq 0x8(%rsp), %rcx
movq %rcx, %rax
shrq $0x3f, %rax
sarq $0x7, %rcx
addq %rax, %rcx
addq 0x180(%rsp), %rcx
cvtsi2sd %rcx, %xmm0
movq %r12, %rax
shrq $0x3f, %rax
sarq $0x7, %r12
addq %rax, %r12
addq %rbx, %r12
cvtsi2sd %r12, %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
leaq 0x128(%rsp), %r14
leaq 0x198(%rsp), %r13
leaq 0x30(%rsp), %r15
jmp 0x31f5
leaq 0x1020(%rcx), %rdx
cmpq %rax, %rdx
je 0x347a
movl 0x1000(%rcx), %edx
addq $0x1024, %rcx           # imm = 0x1024
movl %edx, %esi
movl -0x4(%rcx), %edx
cmpl %esi, %edx
jl 0x3463
jg 0x3451
movl -0x20(%rcx), %esi
cmpl (%rcx), %esi
jg 0x3463
leaq 0x20(%rcx), %rsi
addq $0x1c, %rcx
cmpq %rax, %rcx
movq %rsi, %rcx
jne 0x343f
jmp 0x347a
leaq 0x20(%rbp), %rsi
leaq 0x1c0(%rsp), %rdi
callq 0x41fc
movl $0x1, (%rax)
leaq 0x20(%rbp), %rsi
leaq 0x80(%rsp), %rdi
callq 0x42d6
movq %rax, %rdi
movq %rbx, %rsi
callq 0x4198
cvttsd2si 0x8(%rsp), %ecx
movl %ecx, (%rax)
movq 0x16b23(%rip), %rax     # 0x19fc8
movq (%rax), %rdi
callq 0x21a0
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x34bc
callq 0x2170
movq %rbp, %rdi
callq 0x2110
movq %rax, %rbp
cmpq %r14, %rax
jne 0x30f9
movq 0x50(%rsp), %rdi
callq 0x2110
movq %rax, 0x50(%rsp)
leaq 0xc0(%rsp), %rcx
cmpq %rcx, %rax
jne 0x2fc9
xorpd %xmm0, %xmm0
movapd %xmm0, 0x30(%rsp)
xorl %eax, %eax
movq %rax, 0x40(%rsp)
movq %rax, 0x20(%rsp)
movapd %xmm0, 0x10(%rsp)
movq 0x138(%rsp), %rbx
cmpq %r14, %rbx
je 0x3655
leaq 0x70(%rsp), %rbp
leaq 0x80(%rsp), %r14
leaq 0x20(%rbx), %r15
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
callq 0x440e
movq 0x30(%rsp), %r13
movq 0x38(%rsp), %r12
leaq 0x110(%rsp), %rax
movq %rax, 0x100(%rsp)
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
addq %rsi, %rdx
leaq 0x100(%rsp), %rdi
callq 0x11df8
subq %r13, %r12
shrq $0x5, %r12
decl %r12d
movl $0x0, 0x58(%rsp)
movl %r12d, 0x5c(%rsp)
movq %rbp, 0x60(%rsp)
movq 0x100(%rsp), %rsi
movq 0x108(%rsp), %rdx
addq %rsi, %rdx
leaq 0x60(%rsp), %rdi
callq 0x11df8
leaq 0x10(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x444c
leaq 0xc0(%rsp), %r13
movq 0x60(%rsp), %rdi
cmpq %rbp, %rdi
je 0x35cc
callq 0x2170
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0x35e6
callq 0x2170
movq 0xd0(%rsp), %r12
cmpq %r13, %r12
je 0x3639
movq %r14, %rdi
movq %r15, %rsi
callq 0x42d6
leaq 0x20(%r12), %rsi
movq %rax, %rdi
callq 0x4198
movl (%rax), %eax
testl %eax, %eax
js 0x361b
movq 0x18(%rsp), %rcx
addl %eax, -0x28(%rcx)
jmp 0x3620
cmpl $-0x1, %eax
je 0x3632
movq %r12, %rdi
callq 0x2110
movq %rax, %r12
cmpq %r13, %rax
jne 0x35f3
jmp 0x3639
movl $0xf4240, %eax          # imm = 0xF4240
jmp 0x3611
movq %rbx, %rdi
callq 0x2110
movq %rax, %rbx
leaq 0x128(%rsp), %rax
cmpq %rax, %rbx
jne 0x352a
leaq 0x10ad0(%rip), %rdi     # 0x1412c
leaq 0x10ae4(%rip), %rsi     # 0x14147
xorl %eax, %eax
callq 0x2050
movq 0x138(%rsp), %rbx
leaq 0x128(%rsp), %rax
cmpq %rax, %rbx
je 0x36e3
leaq 0x1c0(%rsp), %r14
leaq 0x10ad2(%rip), %r13     # 0x14160
leaq 0x10ac8(%rip), %rbp     # 0x1415d
leaq 0x10ab7(%rip), %r15     # 0x14153
leaq 0x20(%rbx), %rsi
movq 0x20(%rbx), %r12
movq %r14, %rdi
callq 0x1321a
leaq 0x1c8(%rsp), %rcx
cmpq %rcx, %rax
movq %rbp, %rdx
cmoveq %r13, %rdx
movq %r15, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x2050
movq %rbx, %rdi
callq 0x2110
movq %rax, %rbx
leaq 0x128(%rsp), %rax
cmpq %rax, %rbx
jne 0x369c
xorpd %xmm0, %xmm0
leaq 0x1f0(%rsp), %rbx
movapd %xmm0, (%rbx)
leaq 0x10a6a(%rip), %rsi     # 0x14164
movq %rbx, %rdi
movl $0x8, %edx
xorl %eax, %eax
callq 0x2070
leaq 0x10a61(%rip), %rdi     # 0x14171
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2050
movq 0xd0(%rsp), %rbx
leaq 0xc0(%rsp), %r12
cmpq %r12, %rbx
je 0x3753
leaq 0x10a43(%rip), %r14     # 0x14179
movl 0x20(%rbx), %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x2050
movq %rbx, %rdi
callq 0x2110
movq %rax, %rbx
cmpq %r12, %rax
jne 0x3736
leaq 0x10a27(%rip), %rdi     # 0x14181
callq 0x21f0
leaq 0x10a22(%rip), %rdi     # 0x14188
xorl %eax, %eax
callq 0x2050
movq 0xd0(%rsp), %rbx
cmpq %r12, %rbx
je 0x37a5
leaq 0x10a15(%rip), %r14     # 0x14196
leaq 0x10a13(%rip), %r15     # 0x1419b
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x2050
movq %rbx, %rdi
callq 0x2110
movq %rax, %rbx
cmpq %r12, %rax
jne 0x3788
leaq 0x109f5(%rip), %rdi     # 0x141a1
callq 0x21f0
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %r14
cmpq %r14, %rbx
je 0x391d
movq %r14, %rax
subq %rbx, %rax
sarq $0x3, %rax
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rax, %rcx
bsrq %rcx, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1327e
movq %rbx, %rdi
movq %r14, %rsi
callq 0x133ab
movq 0x10(%rsp), %r14
cmpq 0x18(%rsp), %r14
je 0x391d
leaq 0x58(%rsp), %rbx
leaq 0x80(%rsp), %r12
leaq 0x10985(%rip), %r13     # 0x141a8
leaq 0x1096c(%rip), %rbp     # 0x14196
leaq 0x68(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x8(%r14), %rsi
movq 0x10(%r14), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x11df8
movq 0x58(%rsp), %rsi
leaq 0x1091f(%rip), %rdi     # 0x14172
xorl %eax, %eax
callq 0x2050
movq 0xd0(%rsp), %r15
leaq 0xc0(%rsp), %rax
cmpq %rax, %r15
je 0x38dd
movq %r12, %rdi
movq %rbx, %rsi
callq 0x42d6
leaq 0x20(%r15), %rsi
movq %rax, %rdi
callq 0x4198
movl (%rax), %esi
testl %esi, %esi
js 0x3898
movq %r13, %rdi
xorl %eax, %eax
callq 0x2050
jmp 0x38d0
cmpl $-0x3, %esi
je 0x38bf
cmpl $-0x2, %esi
je 0x38b3
cmpl $-0x1, %esi
jne 0x38d0
movq %rbp, %rdi
leaq 0x108fc(%rip), %rsi     # 0x141ad
jmp 0x38c9
movq %rbp, %rdi
leaq 0x108f6(%rip), %rsi     # 0x141b3
jmp 0x38c9
movq %rbp, %rdi
leaq 0x108f0(%rip), %rsi     # 0x141b9
xorl %eax, %eax
callq 0x2050
movq %r15, %rdi
callq 0x2110
movq %rax, %r15
jmp 0x3862
movslq (%r14), %rax
xorl %edx, %edx
divq 0xe0(%rsp)
leaq 0x108cd(%rip), %rdi     # 0x141be
movl %eax, %esi
xorl %eax, %eax
callq 0x2050
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x390e
callq 0x2170
addq $0x28, %r14
cmpq 0x18(%rsp), %r14
jne 0x382a
leaq 0x108a0(%rip), %rdi     # 0x141c4
movl $0x1e8480, %esi         # imm = 0x1E8480
xorl %eax, %eax
callq 0x2050
movq 0x16691(%rip), %rax     # 0x19fc8
movq (%rax), %rdi
callq 0x21a0
leaq 0x10(%rsp), %rdi
callq 0x4490
leaq 0x30(%rsp), %rdi
callq 0x44da
leaq 0x1c0(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x4ace
leaq 0x80(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x4b16
movq 0xe8(%rsp), %rdi
testq %rdi, %rdi
je 0x3987
callq 0x2170
leaq 0x190(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x4bfe
leaq 0x120(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x4c34
leaq 0x150(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x4c7c
leaq 0xb8(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x4cb2
xorl %eax, %eax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x3b1f
movq %rax, %rbx
jmp 0x3b0e
movq %rax, %rbx
jmp 0x3afd
jmp 0x3a0c
movq %rax, %rbx
jmp 0x3ac9
jmp 0x3a74
movq %rax, %rbx
jmp 0x3a86
jmp 0x3a1a
jmp 0x3a79
movq %rax, %rbx
jmp 0x3ada
jmp 0x3a74
jmp 0x3a74
jmp 0x3a79
movq %rax, %rbx
jmp 0x3aec
jmp 0x3a79
jmp 0x3a79
movq %rax, %rbx
jmp 0x3a3d
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %rbp, %rdi
je 0x3a3d
callq 0x2170
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
jmp 0x3a66
jmp 0x3a79
jmp 0x3a92
jmp 0x3a92
jmp 0x3a92
jmp 0x3a74
movq %rax, %rbx
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x3a7c
callq 0x2170
jmp 0x3a7c
jmp 0x3a97
movq %rax, %rbx
jmp 0x3ab8
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x4490
leaq 0x30(%rsp), %rdi
callq 0x44da
jmp 0x3ab8
movq %rax, %rbx
jmp 0x3aa9
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x3aa9
callq 0x2170
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x3ab8
callq 0x2170
leaq 0x1c0(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x4ace
leaq 0x80(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x4b16
movq 0xe8(%rsp), %rdi
testq %rdi, %rdi
je 0x3aec
callq 0x2170
leaq 0x190(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x4bfe
leaq 0x120(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x4c34
leaq 0x150(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x4c7c
leaq 0xb8(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x4cb2
movq %rbx, %rdi
callq 0x2230
movq %rax, %rdi
callq 0x4000