// File: /workspace/github_cpp_makefile_star2_O1/f18m[P]boost-intrusive-pool/tests/performance_tests.cpp
// Function: do_benchmark(json_ctx*)
static void do_benchmark(json_ctx_t* json_ctx)
{
    typedef struct {
        unsigned int initial_size;
        unsigned int enlarge_step;
        unsigned int num_items;
    } config_t;

    typedef struct {
        BenchPattern_t pattern;
        size_t num_configs;
        config_t config[10]; // max num configs
    } pattern_test_t;

    pattern_test_t testPatterns[] = {
        {
            BENCH_PATTERN_CONTINUOUS_ALLOCATION, // force newline
            4, // force newline

            {
                // run #1 dummy test: a lot of objects and memory pool continuously resizing itself: no gain obtained:
                { 1, 1, (int)1e5 },

                // run #2 slightly better situation: the memory pool has to do 64x less resizings:
                { 128, 64, (int)1e5 }, // force newline

                // run #3 much better real-life example: the memory pool starts small but does only a few resizings
                //        because every time it increases by 1024 items:
                { 1024, 1024, (int)1e5 }, // force newline

                // run #4 optimal example: the memory pool starts bigger and does just 7 resizing steps
                { 16384, 16384, (int)1e5 }, // force newline
            } // force newline
        },

        // another more realistic (???) malloc pattern

        {
            BENCH_PATTERN_MIXED_ALLOC_FREE, // force newline
            3, // force newline

            {
                // run #5 in this test the memory pool begins small and does several resizings
                { 1024, 64, (int)1e5 }, // force newline

                // run #6 in this test the memory pool begins small but does less resizings
                { 1024, 128, (int)1e5 }, // force newline

                // run #7 in this test the memory pool begins with already a lot of items, so it does close-to-zero
                //        resizings:
                { 512 * 1024, 1024, (int)1e6 }, // force newline
            } // force newline
        }
    };

    for (int j = 0; j < sizeof(testPatterns) / sizeof(testPatterns[0]); j++) {
        if (json_ctx) {
            json_attr_object_begin(json_ctx, (std::string("pattern_") + std::to_string(j + 1)).c_str());
            json_attr_string(json_ctx, "desc", BenchPattern2String(testPatterns[j].pattern).c_str());
        }

        for (int i = 0; i < testPatterns[j].num_configs; i++) {
            const config_t& runConfig = testPatterns[j].config[i];

            size_t num_freed[2], max_active[2], ctor_count[2], dtor_count[2], num_resizings;
            struct rusage usage[2];
            timing_t avg_time[2];

            // run the benchmark with boost_intrusive_pool
            {
                LargeObject::reset_counts();

                boost_intrusive_pool<LargeObject> real_pool(
                    runConfig.initial_size /* initial size */, runConfig.enlarge_step /* enlarge step */);

                timing_t start, stop, elapsed, accumulated = 0;
                for (int k = 0; k < NUM_AVERAGING_RUNS; k++) {
                    TIMING_NOW(start);
                    main_benchmark_loop(
                        real_pool, testPatterns[j].pattern, runConfig.num_items, num_freed[0], max_active[0]);
                    TIMING_NOW(stop);
                    TIMING_DIFF(elapsed, start, stop);
                    TIMING_ACCUM(accumulated, elapsed);
                }

                avg_time[0] = accumulated / NUM_AVERAGING_RUNS;
                ctor_count[0] = LargeObject::m_ctor_count;
                dtor_count[0] = LargeObject::m_dtor_count;
                num_resizings = real_pool.enlarge_steps_done();

                getrusage(RUSAGE_SELF, &usage[0]);
            }

            // run the benchmark with NoPool
            {
                LargeObject::reset_counts();

                NoPool comparison_pool;

                timing_t start, stop, elapsed, accumulated = 0;
                for (int k = 0; k < NUM_AVERAGING_RUNS; k++) {
                    TIMING_NOW(start);
                    main_benchmark_loop(
                        comparison_pool, testPatterns[j].pattern, runConfig.num_items, num_freed[1], max_active[1]);
                    TIMING_NOW(stop);
                    TIMING_DIFF(elapsed, start, stop);
                    TIMING_ACCUM(accumulated, elapsed);
                }

                avg_time[1] = accumulated / NUM_AVERAGING_RUNS;
                ctor_count[1] = LargeObject::m_ctor_count;
                dtor_count[1] = LargeObject::m_dtor_count;

                getrusage(RUSAGE_SELF, &usage[1]);
            }

            // output results as JSON:
            if (json_ctx) {
                json_attr_object_begin(json_ctx, ("run_" + std::to_string(i + 1)).c_str());

                // test setup
                json_attr_double(json_ctx, "initial_size", runConfig.initial_size);
                json_attr_double(json_ctx, "enlarge_step", runConfig.enlarge_step);
                json_attr_double(json_ctx, "num_items", runConfig.num_items);

                // test results
                json_attr_object_begin(json_ctx, "boost_intrusive_pool");
                json_attr_double(json_ctx, "duration_nsec", avg_time[0]);
                json_attr_double(json_ctx, "duration_nsec_per_item", (double)avg_time[0] / (double)runConfig.num_items);
                json_attr_double(json_ctx, "num_items_freed", num_freed[0]);
                json_attr_double(json_ctx, "max_active_items", max_active[0]);
                json_attr_double(json_ctx, "max_rss", usage[0].ru_maxrss);
                json_attr_double(json_ctx, "ctor_count", ctor_count[0]);
                json_attr_double(json_ctx, "dtor_count", dtor_count[0]);
                json_attr_double(json_ctx, "num_resizings", num_resizings);
                json_attr_object_end(json_ctx); // boost_intrusive_pool_item

                // test results
                json_attr_object_begin(json_ctx, "plain_malloc");
                json_attr_double(json_ctx, "duration_nsec", avg_time[1]);
                json_attr_double(json_ctx, "duration_nsec_per_item", (double)avg_time[1] / (double)runConfig.num_items);
                json_attr_double(json_ctx, "num_items_freed", num_freed[1]);
                json_attr_double(json_ctx, "max_active_items", max_active[1]);
                json_attr_double(json_ctx, "max_rss", usage[1].ru_maxrss);
                json_attr_double(json_ctx, "ctor_count", ctor_count[1]);
                json_attr_double(json_ctx, "dtor_count", dtor_count[1]);
                json_attr_object_end(json_ctx); // plain_malloc
                json_attr_object_end(json_ctx); // run
            }
        }

        if (json_ctx)
            json_attr_object_end(json_ctx); // run
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x278, %rsp            # imm = 0x278
movq %rdi, 0x70(%rsp)
leaq 0x160(%rsp), %rbx
leaq 0x7cae(%rip), %r14      # 0xa140
leaq 0x50(%rsp), %r13
leaq 0x789a(%rip), %rax      # 0x9d38
addq $0x10, %rax
movq %rax, 0xd8(%rsp)
movq $0x0, 0x88(%rsp)
cmpq $0x0, 0x70(%rsp)
je 0x2670
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
leaq 0x10(%rsp), %rdi
leaq 0x3bd5(%rip), %rsi      # 0x60ad
leaq 0x3bd6(%rip), %rdx      # 0x60b5
callq 0x4b98
leaq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
movl $0x1, %esi
movq %r13, %rdi
movl $0x2d, %edx
callq 0x2180
movq 0x50(%rsp), %rdi
movq 0x88(%rsp), %rax
leal 0x1(%rax), %edx
movl $0x1, %esi
callq 0x373a
movq 0x10(%rsp), %rcx
movl $0xf, %esi
leaq 0x20(%rsp), %rax
cmpq %rax, %rcx
je 0x2533
movq 0x20(%rsp), %rsi
movq 0x18(%rsp), %r8
movq 0x58(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rsi, %rax
jbe 0x2561
movl $0xf, %esi
leaq 0x60(%rsp), %rdi
cmpq %rdi, 0x50(%rsp)
je 0x255c
movq 0x60(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x2572
movq 0x50(%rsp), %rsi
leaq 0x10(%rsp), %rdi
callq 0x2060
jmp 0x257e
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2160
movq %rbx, 0x150(%rsp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x25a7
movq %rdx, 0x150(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x160(%rsp)
jmp 0x25af
movupd (%rcx), %xmm0
movupd %xmm0, (%rbx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x158(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
movq 0x150(%rsp), %rsi
movq 0x70(%rsp), %rdi
callq 0x4cbe
movq 0x150(%rsp), %rdi
cmpq %rbx, %rdi
je 0x25f3
callq 0x2130
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x2607
callq 0x2130
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x261b
callq 0x2130
movq 0x88(%rsp), %rcx
movq %rcx, %rax
shlq $0x7, %rax
leaq (%rax,%rcx,8), %rax
leaq 0x42eb(%rip), %rcx      # 0x6920
movl (%rcx,%rax), %esi
leaq 0x150(%rsp), %rdi
callq 0x23bc
movq 0x150(%rsp), %rdx
movq 0x70(%rsp), %rdi
leaq 0x3a5d(%rip), %rsi      # 0x60b6
callq 0x4d44
movq 0x150(%rsp), %rdi
cmpq %rbx, %rdi
je 0x2670
callq 0x2130
movq 0x88(%rsp), %rcx
movq %rcx, %rax
shlq $0x7, %rax
leaq (%rax,%rcx,8), %rdx
leaq 0x4296(%rip), %rax      # 0x6920
movq 0x8(%rax,%rdx), %rax
movq %rax, 0xf8(%rsp)
testq %rax, %rax
je 0x344b
movq %rdx, %rcx
leaq 0x4276(%rip), %rax      # 0x6920
addq %rax, %rcx
movq %rcx, 0xd0(%rsp)
leaq 0x10(%rcx), %r15
xorl %r12d, %r12d
movq %r15, 0xf0(%rsp)
leaq (%r12,%r12,2), %rbx
xorl %eax, %eax
movq %rax, (%r14)
leaq 0x7a74(%rip), %rcx      # 0xa148
movq %rax, (%rcx)
movq %r13, %rdi
movl (%r15,%rbx,4), %r13d
movl 0x4(%r15,%rbx,4), %r14d
xorpd %xmm0, %xmm0
movapd %xmm0, 0x120(%rsp)
movapd %xmm0, 0x130(%rsp)
movq %rdi, %rbp
movq %r13, %rsi
movq %r14, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
leaq 0x120(%rsp), %r9
callq 0x3634
movq 0x130(%rsp), %rax
testq %rax, %rax
je 0x2733
leaq 0x120(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq %r13, 0x118(%rsp)
movq %r14, 0xb8(%rsp)
movq %r12, 0xc8(%rsp)
leaq (%r15,%rbx,4), %rax
movq %rax, 0x80(%rsp)
xorl %ebx, %ebx
xorl %r15d, %r15d
leaq 0x10(%rsp), %r14
movq %rbp, %r13
movl %r15d, (%rsp)
movl $0x2, %edi
movq %r14, %rsi
callq 0x2120
movq 0x10(%rsp), %r12
movq 0x18(%rsp), %r15
movq 0xd0(%rsp), %rax
movl (%rax), %eax
movq 0x80(%rsp), %rcx
movl 0x8(%rcx), %r14d
cmpl $0x1, %eax
movq %r15, 0x98(%rsp)
movq %r12, 0x90(%rsp)
je 0x284f
xorpd %xmm0, %xmm0
movapd %xmm0, 0xe0(%rsp)
testl %eax, %eax
jne 0x2a88
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x4124
testl %r14d, %r14d
je 0x2a91
movq %r13, %r15
xorl %r12d, %r12d
leaq 0x8(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x41ee
movq 0x8(%rsp), %rax
testq %rax, %rax
je 0x34b0
addb $0x2, 0x2a(%rax)
addb $0x2, 0x34(%rax)
leaq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x423e
movq 0x18(%rsp), %rbp
subq 0x10(%rsp), %rbp
sarq $0x3, %rbp
cmpq %rbp, %r12
cmovaq %r12, %rbp
movq %r13, %rdi
callq 0x4268
movq %rbp, %r12
decl %r14d
jne 0x27f7
jmp 0x2a93
leaq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
movq $0x1, 0x18(%rsp)
leaq 0x20(%rsp), %rax
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
movl $0x3f800000, 0x30(%rsp) # imm = 0x3F800000
movupd %xmm0, 0x18(%rax)
movq %r14, %rax
movabsq $0x199999999999999a, %rcx # imm = 0x199999999999999A
mulq %rcx
leaq 0x10(%rsp), %rdi
movq %rdx, %rsi
callq 0x4614
testl %r14d, %r14d
je 0x2acf
movq $0x0, 0xa0(%rsp)
xorl %ebp, %ebp
xorl %r12d, %r12d
leaq 0x78(%rsp), %r13
movq %r13, %rdi
leaq 0x50(%rsp), %rsi
callq 0x41ee
movq 0x78(%rsp), %rax
testq %rax, %rax
je 0x3491
addb $0x2, 0x2a(%rax)
addb $0x2, 0x34(%rax)
imull $0x3e0f83e1, %r12d, %eax # imm = 0x3E0F83E1
cmpl $0x7c1f07d, %eax        # imm = 0x7C1F07D
jb 0x2a3b
movl %r12d, 0xc4(%rsp)
leaq 0x10(%rsp), %rdi
leaq 0xc4(%rsp), %rsi
callq 0x47f4
movq 0x78(%rsp), %rcx
movq %rcx, 0x8(%rsp)
testq %rcx, %rcx
je 0x291a
incq 0x8(%rcx)
movq (%rax), %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, (%rax)
leaq 0x8(%rsp), %rdi
callq 0x4268
imull $0x8c13521d, %r12d, %eax # imm = 0x8C13521D
cmpl $0x4d4873f, %eax        # imm = 0x4D4873F
jb 0x29a9
movl %r12d, %eax
movq %rax, %rcx
movl $0xcccccccd, %edx       # imm = 0xCCCCCCCD
imulq %rdx, %rcx
shrq $0x25, %rcx
shll $0x3, %ecx
leal (%rcx,%rcx,4), %ecx
movl %r12d, %edx
subl %ecx, %edx
je 0x29a9
imulq $0x24924925, %rax, %rcx # imm = 0x24924925
shrq $0x20, %rcx
movl %r12d, %edx
subl %ecx, %edx
shrl %edx
addl %ecx, %edx
shrl $0x2, %edx
leal (,%rdx,8), %ecx
subl %ecx, %edx
addl %r12d, %edx
je 0x29a9
imulq $0x8421085, %rax, %rax  # imm = 0x8421085
shrq $0x20, %rax
movl %r12d, %ecx
subl %eax, %ecx
shrl %ecx
addl %eax, %ecx
shrl $0x4, %ecx
movl %ecx, %eax
shll $0x5, %eax
subl %eax, %ecx
addl %r12d, %ecx
jne 0x2a2f
leal -0x1(%r12), %edi
movslq %edi, %rax
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %r8
xorl %edx, %edx
divq %r8
movq %rdx, %rcx
movq (%rsi,%rdx,8), %rdx
movl $0x0, %eax
testq %rdx, %rdx
je 0x2a09
movq (%rdx), %r9
movq %rdx, %rax
cmpl 0x8(%r9), %edi
je 0x2a09
movq %r9, %r10
movq (%r9), %r9
testq %r9, %r9
je 0x2a07
movslq 0x8(%r9), %rsi
movq %rsi, %rax
xorl %edx, %edx
divq %r8
movl $0x0, %eax
cmpq %rcx, %rdx
jne 0x2a09
movq %r10, %rax
cmpl %esi, %edi
jne 0x29dd
jmp 0x2a09
xorl %eax, %eax
testq %rax, %rax
je 0x2a2f
cmpq $0x0, (%rax)
je 0x2a2f
movl %edi, 0x8(%rsp)
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x49ba
incq 0xa0(%rsp)
movq 0x28(%rsp), %rax
cmpq %rax, %rbp
cmovbeq %rax, %rbp
leaq 0x78(%rsp), %r13
movq %r13, %rdi
callq 0x4268
incl %r12d
cmpl %r14d, %r12d
jne 0x28b8
movsd 0xa0(%rsp), %xmm0
unpcklps 0x35ac(%rip), %xmm0     # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x35b4(%rip), %xmm0     # 0x6020
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, 0xe0(%rsp)
leaq 0x50(%rsp), %r13
jmp 0x2ade
xorl %ebp, %ebp
leaq 0x10(%rsp), %r14
jmp 0x2aeb
xorl %ebp, %ebp
movq 0x10(%rsp), %r12
movq 0x18(%rsp), %r13
cmpq %r12, %r13
je 0x2abb
movq %r12, %r14
movq %r14, %rdi
callq 0x4268
addq $0x8, %r14
cmpq %r13, %r14
jne 0x2aa5
movq %r12, 0x18(%rsp)
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x429a
leaq 0x50(%rsp), %r13
jmp 0x2aeb
xorpd %xmm0, %xmm0
movapd %xmm0, 0xe0(%rsp)
xorl %ebp, %ebp
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x4aa6
movl (%rsp), %r15d
movl $0x2, %edi
movq %r14, %rsi
callq 0x2120
movq 0x10(%rsp), %rax
subq 0x90(%rsp), %rax
subq 0x98(%rsp), %rbx
movq %rbx, %rcx
addq 0x18(%rsp), %rcx
imulq $0x3b9aca00, %rax, %rbx # imm = 0x3B9ACA00
addq %rcx, %rbx
incl %r15d
cmpl $0xa, %r15d
jne 0x2764
movq %rbx, %rax
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
mulq %rcx
movq 0x58(%rsp), %rax
testq %rax, %rax
je 0x2b93
addq $0x40, %rax
movq $-0x1, %rcx
leaq 0x75e4(%rip), %r15      # 0xa140
movq (%rax), %rax
incq %rcx
testq %rax, %rax
jne 0x2b5c
movq %rcx, %xmm0
punpckldq 0x349c(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x34a4(%rip), %xmm0     # 0x6020
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, 0x140(%rsp)
jmp 0x2ba7
xorpd %xmm0, %xmm0
movapd %xmm0, 0x140(%rsp)
leaq 0x7599(%rip), %r15      # 0xa140
shrq $0x3, %rdx
movq %rdx, 0x100(%rsp)
movq (%r15), %rax
movq %rax, 0x108(%rsp)
leaq 0x7583(%rip), %rbx      # 0xa148
movq (%rbx), %rax
movq %rax, 0x110(%rsp)
xorl %edi, %edi
leaq 0x150(%rsp), %rsi
callq 0x20c0
movq %r13, %rdi
callq 0x36f0
xorl %r14d, %r14d
movq %r14, (%r15)
movq %r14, (%rbx)
xorl %ebx, %ebx
leaq 0x10(%rsp), %r12
movq %r14, (%rsp)
movl $0x2, %edi
movq %r12, %rsi
callq 0x2120
movq 0x10(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0x18(%rsp), %r13
movq 0xd0(%rsp), %rax
movl (%rax), %eax
movq 0x80(%rsp), %rcx
movl 0x8(%rcx), %r14d
cmpl $0x1, %eax
movq %r13, 0x98(%rsp)
je 0x2cfa
xorpd %xmm0, %xmm0
movapd %xmm0, 0xa0(%rsp)
testl %eax, %eax
jne 0x2f3a
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq %r12, %rdi
movq %r14, %rsi
callq 0x4124
testl %r14d, %r14d
je 0x2f3f
xorl %r12d, %r12d
movl $0x420, %edi            # imm = 0x420
callq 0x2140
xorpd %xmm0, %xmm0
movupd %xmm0, 0x8(%rax)
movq $0x0, 0x18(%rax)
movq 0xd8(%rsp), %rcx
movq %rcx, (%rax)
incq (%r15)
movq $0x1, 0x8(%rax)
addb $0x2, 0x2a(%rax)
movq %rax, 0x50(%rsp)
addb $0x2, 0x34(%rax)
leaq 0x10(%rsp), %rdi
leaq 0x50(%rsp), %r13
movq %r13, %rsi
callq 0x423e
movq %r13, %rdi
movq 0x18(%rsp), %r13
subq 0x10(%rsp), %r13
sarq $0x3, %r13
cmpq %r13, %r12
cmovaq %r12, %r13
callq 0x4268
movq %r13, %r12
decl %r14d
jne 0x2c80
jmp 0x2f42
leaq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
movq $0x1, 0x18(%rsp)
leaq 0x20(%rsp), %rax
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
movl $0x3f800000, 0x30(%rsp) # imm = 0x3F800000
movupd %xmm0, 0x18(%rax)
movq %r14, %rax
movabsq $0x199999999999999a, %rcx # imm = 0x199999999999999A
mulq %rcx
movq %r12, %rdi
movq %rdx, %rsi
callq 0x4614
testl %r14d, %r14d
je 0x2f80
xorl %r13d, %r13d
movq $0x0, 0xa0(%rsp)
xorl %r12d, %r12d
movl $0x420, %edi            # imm = 0x420
callq 0x2140
xorpd %xmm0, %xmm0
movupd %xmm0, 0x8(%rax)
movq $0x0, 0x18(%rax)
movq 0xd8(%rsp), %rcx
movq %rcx, (%rax)
incq (%r15)
movq $0x1, 0x8(%rax)
addb $0x2, 0x2a(%rax)
addb $0x2, 0x34(%rax)
movq %rax, 0x8(%rsp)
imull $0x3e0f83e1, %r12d, %eax # imm = 0x3E0F83E1
cmpl $0x7c1f07d, %eax        # imm = 0x7C1F07D
jb 0x2ef5
movl %r12d, 0x78(%rsp)
leaq 0x10(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x47f4
movq 0x8(%rsp), %rcx
movq %rcx, 0x50(%rsp)
testq %rcx, %rcx
je 0x2dd4
incq 0x8(%rcx)
movq (%rax), %rdx
movq %rdx, 0x50(%rsp)
movq %rcx, (%rax)
leaq 0x50(%rsp), %rdi
callq 0x4268
imull $0x8c13521d, %r12d, %eax # imm = 0x8C13521D
cmpl $0x4d4873f, %eax        # imm = 0x4D4873F
jb 0x2e63
movl %r12d, %eax
movq %rax, %rcx
movl $0xcccccccd, %edx       # imm = 0xCCCCCCCD
imulq %rdx, %rcx
shrq $0x25, %rcx
shll $0x3, %ecx
leal (%rcx,%rcx,4), %ecx
movl %r12d, %edx
subl %ecx, %edx
je 0x2e63
imulq $0x24924925, %rax, %rcx # imm = 0x24924925
shrq $0x20, %rcx
movl %r12d, %edx
subl %ecx, %edx
shrl %edx
addl %ecx, %edx
shrl $0x2, %edx
leal (,%rdx,8), %ecx
subl %ecx, %edx
addl %r12d, %edx
je 0x2e63
imulq $0x8421085, %rax, %rax  # imm = 0x8421085
shrq $0x20, %rax
movl %r12d, %ecx
subl %eax, %ecx
shrl %ecx
addl %eax, %ecx
shrl $0x4, %ecx
movl %ecx, %eax
shll $0x5, %eax
subl %eax, %ecx
addl %r12d, %ecx
jne 0x2ee9
leal -0x1(%r12), %edi
movslq %edi, %rax
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %r8
xorl %edx, %edx
divq %r8
movq %rdx, %rcx
movq (%rsi,%rdx,8), %rdx
movl $0x0, %eax
testq %rdx, %rdx
je 0x2ec3
movq (%rdx), %r9
movq %rdx, %rax
cmpl 0x8(%r9), %edi
je 0x2ec3
movq %r9, %r10
movq (%r9), %r9
testq %r9, %r9
je 0x2ec1
movslq 0x8(%r9), %rsi
movq %rsi, %rax
xorl %edx, %edx
divq %r8
movl $0x0, %eax
cmpq %rcx, %rdx
jne 0x2ec3
movq %r10, %rax
cmpl %esi, %edi
jne 0x2e97
jmp 0x2ec3
xorl %eax, %eax
testq %rax, %rax
je 0x2ee9
cmpq $0x0, (%rax)
je 0x2ee9
movl %edi, 0x50(%rsp)
leaq 0x10(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x49ba
incq 0xa0(%rsp)
movq 0x28(%rsp), %rax
cmpq %rax, %r13
cmovbeq %rax, %r13
leaq 0x8(%rsp), %rdi
callq 0x4268
incl %r12d
cmpl %r14d, %r12d
jne 0x2d5d
movsd 0xa0(%rsp), %xmm0
unpcklps 0x30f5(%rip), %xmm0     # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x30fd(%rip), %xmm0     # 0x6020
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, 0xa0(%rsp)
jmp 0x2f90
xorl %r13d, %r13d
jmp 0x2f9d
xorl %r13d, %r13d
movq 0x10(%rsp), %r12
movq 0x18(%rsp), %r15
cmpq %r12, %r15
je 0x2f6a
movq %r12, %r14
movq %r14, %rdi
callq 0x4268
addq $0x8, %r14
cmpq %r15, %r14
jne 0x2f54
movq %r12, 0x18(%rsp)
leaq 0x10(%rsp), %r12
movq %r12, %rdi
callq 0x429a
leaq 0x71c2(%rip), %r15      # 0xa140
jmp 0x2f9d
xorpd %xmm0, %xmm0
movapd %xmm0, 0xa0(%rsp)
xorl %r13d, %r13d
leaq 0x10(%rsp), %r12
movq %r12, %rdi
callq 0x4aa6
movq (%rsp), %r14
movl $0x2, %edi
movq %r12, %rsi
callq 0x2120
movq 0x10(%rsp), %rax
subq 0x90(%rsp), %rax
subq 0x98(%rsp), %rbx
movq %rbx, %rcx
addq 0x18(%rsp), %rcx
imulq $0x3b9aca00, %rax, %rbx # imm = 0x3B9ACA00
addq %rcx, %rbx
incl %r14d
cmpl $0xa, %r14d
jne 0x2bf7
movq %rbx, %rax
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
mulq %rcx
movq %rdx, (%rsp)
movq (%r15), %rbx
leaq 0x7148(%rip), %rax      # 0xa148
movq (%rax), %r15
xorl %edi, %edi
leaq 0x1e0(%rsp), %rsi
callq 0x20c0
cmpq $0x0, 0x70(%rsp)
je 0x341e
movq %rbx, 0x98(%rsp)
movq 0xc8(%rsp), %rax
leaq 0x1(%rax), %r14
movl $0x1, %ebx
cmpq $0x9, %rax
jb 0x307f
movl $0x4, %ebx
movl %r14d, %eax
movl $0xd1b71759, %edx       # imm = 0xD1B71759
cmpl $0x63, %eax
jbe 0x3078
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x307d
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x307f
movl %eax, %ecx
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %ebx
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x304a
addl $-0x3, %ebx
jmp 0x307f
addl $-0x2, %ebx
jmp 0x307f
decl %ebx
movl %ebx, %esi
leaq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
leaq 0x50(%rsp), %r12
movq %r12, %rdi
movl $0x2d, %edx
callq 0x2180
movq 0x50(%rsp), %rdi
movl %ebx, %esi
movl %r14d, %edx
callq 0x373a
movl $0x4, %r8d
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x2ffb(%rip), %rcx      # 0x60bb
callq 0x2160
leaq 0x20(%rsp), %rsi
movq %rsi, 0x10(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x30ed
movq %rdx, 0x10(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x20(%rsp)
jmp 0x30f5
movupd (%rcx), %xmm0
movupd %xmm0, (%rsi)
movq 0x70(%rsp), %rbx
movq 0x8(%rax), %rdx
movq %rdx, 0x18(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x4cbe
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x3133
callq 0x2130
movq %r15, 0x90(%rsp)
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x314f
callq 0x2130
shrq $0x3, (%rsp)
movl 0x118(%rsp), %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movq %rbx, %rdi
leaq 0x2f53(%rip), %rsi      # 0x60c0
callq 0x4e4c
movl 0xb8(%rsp), %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movq %rbx, %rdi
leaq 0x2f42(%rip), %rsi      # 0x60cd
callq 0x4e4c
movq 0x80(%rsp), %rax
movl 0x8(%rax), %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x80(%rsp)
movq %rbx, %rdi
leaq 0x2f24(%rip), %rsi      # 0x60da
callq 0x4e4c
movq %rbx, %rdi
leaq 0x2f1f(%rip), %rsi      # 0x60e4
callq 0x4cbe
xorps %xmm0, %xmm0
cvtsi2sdq 0x100(%rsp), %xmm0
movsd %xmm0, 0xb8(%rsp)
movq %rbx, %rdi
leaq 0x2f0f(%rip), %r14      # 0x60f9
movq %r14, %rsi
callq 0x4e4c
movsd 0xb8(%rsp), %xmm0
divsd 0x80(%rsp), %xmm0
movq %rbx, %rdi
leaq 0x2ef9(%rip), %r12      # 0x6107
movq %r12, %rsi
callq 0x4e4c
movq %rbx, %rdi
leaq 0x2efe(%rip), %r15      # 0x611e
movq %r15, %rsi
movaps 0xe0(%rsp), %xmm0
callq 0x4e4c
movq %rbp, %xmm1
movq 0x2dd3(%rip), %xmm0     # 0x6010
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movapd 0x2dd7(%rip), %xmm0     # 0x6020
subpd %xmm0, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq %rbx, %rdi
leaq 0x2ecb(%rip), %rbp      # 0x612e
movq %rbp, %rsi
callq 0x4e4c
xorps %xmm0, %xmm0
cvtsi2sdq 0x170(%rsp), %xmm0
movq %rbx, %rdi
leaq 0x2ebd(%rip), %rsi      # 0x613f
callq 0x4e4c
movsd 0x108(%rsp), %xmm1
unpcklps 0x2d79(%rip), %xmm1     # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x2d81(%rip), %xmm1     # 0x6020
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq %rbx, %rdi
leaq 0x2e92(%rip), %rsi      # 0x6147
callq 0x4e4c
movsd 0x110(%rsp), %xmm1
unpcklps 0x2d46(%rip), %xmm1     # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x2d4e(%rip), %xmm1     # 0x6020
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq %rbx, %rdi
leaq 0x2e6a(%rip), %rsi      # 0x6152
callq 0x4e4c
movq %rbx, %rdi
leaq 0x2e66(%rip), %rsi      # 0x615d
movaps 0x140(%rsp), %xmm0
callq 0x4e4c
movq %rbx, %rdi
callq 0x4d12
movq %rbx, %rdi
leaq 0x2e55(%rip), %rsi      # 0x616b
callq 0x4cbe
xorps %xmm0, %xmm0
cvtsi2sdq (%rsp), %xmm0
movsd %xmm0, (%rsp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4e4c
movsd (%rsp), %xmm0
divsd 0x80(%rsp), %xmm0
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4e4c
movq %rbx, %rdi
movq %r15, %rsi
movaps 0xa0(%rsp), %xmm0
callq 0x4e4c
movq %r13, %xmm1
punpckldq 0x2ca3(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x2cab(%rip), %xmm1     # 0x6020
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x4e4c
xorps %xmm0, %xmm0
cvtsi2sdq 0x200(%rsp), %xmm0
movq %rbx, %rdi
leaq 0x2d9c(%rip), %rsi      # 0x613f
callq 0x4e4c
movsd 0x98(%rsp), %xmm1
unpcklps 0x2c58(%rip), %xmm1     # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x2c60(%rip), %xmm1     # 0x6020
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq %rbx, %rdi
leaq 0x2d71(%rip), %rsi      # 0x6147
callq 0x4e4c
movsd 0x90(%rsp), %xmm1
unpcklps 0x2c25(%rip), %xmm1     # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x2c2d(%rip), %xmm1     # 0x6020
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq %rbx, %rdi
leaq 0x2d49(%rip), %rsi      # 0x6152
callq 0x4e4c
movq %rbx, %rdi
callq 0x4d12
movq %rbx, %rdi
callq 0x4d12
movq 0xc8(%rsp), %r12
incq %r12
cmpq 0xf8(%rsp), %r12
leaq 0x6d08(%rip), %r14      # 0xa140
leaq 0x50(%rsp), %r13
movq 0xf0(%rsp), %r15
jne 0x26c4
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x345a
callq 0x4d12
movq 0x88(%rsp), %rcx
leaq 0x1(%rcx), %rax
testq %rcx, %rcx
movq %rax, 0x88(%rsp)
leaq 0x160(%rsp), %rbx
je 0x24b6
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x31db(%rip), %rdi      # 0x6673
leaq 0x31e2(%rip), %rsi      # 0x6681
leaq 0x31f7(%rip), %rcx      # 0x669d
movl $0x85, %edx
callq 0x20d0
leaq 0x31bc(%rip), %rdi      # 0x6673
leaq 0x31c3(%rip), %rsi      # 0x6681
leaq 0x31d8(%rip), %rcx      # 0x669d
movl $0x72, %edx
callq 0x20d0
movq %rbx, %rcx
movq %rax, %rbx
movq 0x150(%rsp), %rdi
cmpq %rcx, %rdi
je 0x34ec
callq 0x2130
jmp 0x34ec
movq %rax, %rbx
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x3505
callq 0x2130
jmp 0x3505
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
jmp 0x3557
movq %rax, %rbx
jmp 0x362b
movq %rbx, %rcx
movq %rax, %rbx
movq 0x150(%rsp), %rdi
cmpq %rcx, %rdi
jne 0x3560
jmp 0x362b
movq %rax, %rbx
jmp 0x354d
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x354d
callq 0x2130
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x362b
callq 0x2130
jmp 0x362b
jmp 0x3597
movq %rax, %rbx
movq 0x130(%rsp), %rax
testq %rax, %rax
je 0x362b
leaq 0x120(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x362b
movq %rax, %rdi
callq 0x372f
jmp 0x35c9
jmp 0x35e7
jmp 0x3614
jmp 0x3605
jmp 0x35ab
jmp 0x35ba
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4268
jmp 0x35ea
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x4268
jmp 0x3617
movq %rax, %rbx
jmp 0x35db
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x4268
leaq 0x10(%rsp), %rdi
callq 0x429a
jmp 0x362b
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x4aa6
jmp 0x362b
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4268
jmp 0x3608
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x429a
jmp 0x3621
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x4aa6
leaq 0x50(%rsp), %rdi
callq 0x36f0
movq %rbx, %rdi
callq 0x2210
nop