// File: /workspace/github_cpp_makefile_star2_O3/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 $0x288, %rsp            # imm = 0x288
leaq 0x170(%rsp), %r14
movb $0x1, %al
leaq 0x68(%rsp), %r12
leaq 0x78a4(%rip), %rcx      # 0x9d38
addq $0x10, %rcx
movq %rcx, 0xd8(%rsp)
xorl %ebx, %ebx
movq %rdi, 0x58(%rsp)
movl %eax, 0xc0(%rsp)
testq %rdi, %rdi
je 0x264d
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq %rsp, %rdi
leaq 0x3be3(%rip), %rsi      # 0x60ad
leaq 0x3be4(%rip), %rdx      # 0x60b5
callq 0x4b06
leaq 0x78(%rsp), %rax
movq %rax, 0x68(%rsp)
movl $0x1, %esi
movq %r12, %rdi
movl $0x2d, %edx
callq 0x2180
movq 0x68(%rsp), %rdi
leal 0x1(%rbx), %edx
movl $0x1, %esi
callq 0x3670
movq (%rsp), %rcx
movl $0xf, %edi
leaq 0x10(%rsp), %rax
cmpq %rax, %rcx
je 0x251c
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %r8
movq 0x68(%rsp), %rsi
movq 0x70(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rdi, %rax
jbe 0x254d
movl $0xf, %edi
leaq 0x78(%rsp), %r9
cmpq %r9, %rsi
je 0x2548
movq 0x78(%rsp), %rdi
cmpq %rdi, %rax
jbe 0x2557
movq %rsp, %rdi
callq 0x2060
jmp 0x2563
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2160
movq %r14, 0x160(%rsp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x258c
movq %rdx, 0x160(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x170(%rsp)
jmp 0x2595
movupd (%rcx), %xmm0
movupd %xmm0, (%r14)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x168(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
movq 0x160(%rsp), %rsi
movq 0x58(%rsp), %rdi
callq 0x4c3f
movq 0x160(%rsp), %rdi
cmpq %r14, %rdi
je 0x25d9
callq 0x2130
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x25ed
callq 0x2130
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x2600
callq 0x2130
movq %rbx, %rax
shlq $0x7, %rax
leaq (%rax,%rbx,8), %rax
leaq 0x430e(%rip), %rcx      # 0x6920
movl (%rcx,%rax), %esi
leaq 0x160(%rsp), %rdi
callq 0x23bc
movq 0x160(%rsp), %rdx
movq 0x58(%rsp), %rdi
leaq 0x3a80(%rip), %rsi      # 0x60b6
callq 0x4ccb
movq 0x160(%rsp), %rdi
cmpq %r14, %rdi
je 0x264d
callq 0x2130
movq %rbx, %rax
shlq $0x7, %rax
leaq (%rax,%rbx,8), %rdx
leaq 0x42c1(%rip), %rax      # 0x6920
movq 0x8(%rax,%rdx), %rax
movq %rax, 0xf0(%rsp)
testq %rax, %rax
je 0x3399
movq %rdx, %rcx
leaq 0x42a1(%rip), %rax      # 0x6920
addq %rax, %rcx
movq %rcx, 0x128(%rsp)
leaq 0x10(%rcx), %r15
xorl %eax, %eax
movq %r15, 0xc8(%rsp)
movq %rax, 0xd0(%rsp)
leaq (%rax,%rax,2), %rbx
xorl %eax, %eax
leaq 0x7a93(%rip), %rcx      # 0xa140
movq %rax, (%rcx)
leaq 0x7a91(%rip), %rcx      # 0xa148
movq %rax, (%rcx)
movl (%r15,%rbx,4), %r13d
movl 0x4(%r15,%rbx,4), %r14d
xorpd %xmm0, %xmm0
movapd %xmm0, 0x130(%rsp)
movapd %xmm0, 0x140(%rsp)
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
leaq 0x130(%rsp), %r9
callq 0x356a
movq 0x140(%rsp), %rax
testq %rax, %rax
je 0x2713
leaq 0x130(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq %r13, 0x118(%rsp)
movq %r14, 0x120(%rsp)
leaq (%r15,%rbx,4), %rax
movq %rax, 0xb8(%rsp)
xorl %r14d, %r14d
xorl %ebp, %ebp
movq %rsp, %r15
movl %ebp, 0x60(%rsp)
movl $0x2, %edi
movq %r15, %rsi
callq 0x2120
movq (%rsp), %r13
movq 0x8(%rsp), %r15
movq 0x128(%rsp), %rax
movl (%rax), %ebx
movq 0xb8(%rsp), %rax
movl 0x8(%rax), %ebp
cmpl $0x1, %ebx
movq %rbp, 0x90(%rsp)
movq %r15, 0x50(%rsp)
movq %r13, 0x98(%rsp)
je 0x281e
xorpd %xmm0, %xmm0
movapd %xmm0, 0xe0(%rsp)
testl %ebx, %ebx
jne 0x2a2c
xorpd %xmm0, %xmm0
movapd %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq %rsp, %rdi
movq %rbp, %rsi
callq 0x40b4
testl %ebp, %ebp
movl %ebx, 0x48(%rsp)
je 0x2a34
xorl %r15d, %r15d
leaq 0x40(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x418c
movq 0x40(%rsp), %rax
testq %rax, %rax
je 0x33f6
addb $0x2, 0x2a(%rax)
addb $0x2, 0x34(%rax)
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x41d2
movq 0x8(%rsp), %r13
subq (%rsp), %r13
sarq $0x3, %r13
cmpq %r13, %r15
cmovaq %r15, %r13
movq %rbx, %rdi
callq 0x41fc
movq %r13, %r15
decl %ebp
jne 0x27ca
jmp 0x2a37
leaq 0x30(%rsp), %rax
movq %rax, (%rsp)
movq $0x1, 0x8(%rsp)
xorpd %xmm0, %xmm0
leaq 0x10(%rsp), %rax
movupd %xmm0, (%rax)
movl $0x3f800000, 0x20(%rsp) # imm = 0x3F800000
movupd %xmm0, 0x18(%rax)
movl %ebp, %esi
movl $0xcccccccd, %eax       # imm = 0xCCCCCCCD
imulq %rax, %rsi
shrq $0x23, %rsi
movq %rsp, %rdi
callq 0x45ae
testl %ebp, %ebp
je 0x2a74
movl %ebx, 0x48(%rsp)
movq $0x0, 0xa0(%rsp)
xorl %r13d, %r13d
xorl %r15d, %r15d
leaq 0x88(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x418c
movq 0x88(%rsp), %rax
testq %rax, %rax
je 0x33d7
addb $0x2, 0x2a(%rax)
addb $0x2, 0x34(%rax)
imull $0x3e0f83e1, %r15d, %eax # imm = 0x3E0F83E1
cmpl $0x7c1f07d, %eax        # imm = 0x7C1F07D
jb 0x29dd
movl %r15d, 0xc4(%rsp)
movq %rsp, %rdi
leaq 0xc4(%rsp), %rsi
callq 0x4788
movq 0x88(%rsp), %rcx
testq %rcx, %rcx
je 0x28e6
incq 0x8(%rcx)
movq (%rax), %rdx
movq %rdx, 0x40(%rsp)
movq %rcx, (%rax)
leaq 0x40(%rsp), %rdi
callq 0x41fc
imull $0x8c13521d, %r15d, %eax # imm = 0x8C13521D
cmpl $0x4d4873f, %eax        # imm = 0x4D4873F
jb 0x2971
movl %r15d, %eax
movq %rax, %rcx
movl $0xcccccccd, %edx       # imm = 0xCCCCCCCD
imulq %rdx, %rcx
shrq $0x25, %rcx
shll $0x3, %ecx
leal (%rcx,%rcx,4), %ecx
movl %r15d, %edx
subl %ecx, %edx
je 0x2971
imulq $0x24924925, %rax, %rcx # imm = 0x24924925
shrq $0x20, %rcx
movl %r15d, %edx
subl %ecx, %edx
shrl %edx
addl %ecx, %edx
shrl $0x2, %edx
leal (,%rdx,8), %ecx
subl %ecx, %edx
addl %r15d, %edx
je 0x2971
imulq $0x8421085, %rax, %rax  # imm = 0x8421085
shrq $0x20, %rax
movl %r15d, %ecx
subl %eax, %ecx
shrl %ecx
addl %eax, %ecx
shrl $0x4, %ecx
movl %ecx, %eax
shll $0x5, %eax
subl %eax, %ecx
addl %r15d, %ecx
jne 0x29d1
leal -0x1(%r15), %edi
movslq %edi, %rax
movq (%rsp), %rsi
movq 0x8(%rsp), %r8
xorl %edx, %edx
divq %r8
movq (%rsi,%rdx,8), %rax
testq %rax, %rax
je 0x29d1
movq %rdx, %rcx
movq (%rax), %r9
cmpl 0x8(%r9), %edi
je 0x29b8
movq (%r9), %r9
testq %r9, %r9
je 0x29d1
movslq 0x8(%r9), %rsi
movq %rsi, %rax
xorl %edx, %edx
divq %r8
cmpq %rcx, %rdx
jne 0x29d1
cmpl %esi, %edi
jne 0x299b
movl %edi, 0x40(%rsp)
movq %rsp, %rdi
leaq 0x40(%rsp), %rsi
callq 0x491e
incq 0xa0(%rsp)
movq 0x18(%rsp), %rax
cmpq %rax, %r13
cmovbeq %rax, %r13
leaq 0x88(%rsp), %rbx
movq %rbx, %rdi
callq 0x41fc
incl %r15d
cmpl %ebp, %r15d
jne 0x2887
movsd 0xa0(%rsp), %xmm0
unpcklps 0x3607(%rip), %xmm0     # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x360f(%rip), %xmm0     # 0x6020
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, 0xe0(%rsp)
movl 0x48(%rsp), %ebx
jmp 0x2a84
xorl %r13d, %r13d
movq %rsp, %r15
jmp 0x2a8f
xorl %r13d, %r13d
movq (%rsp), %r15
movq 0x8(%rsp), %r12
cmpq %r15, %r12
je 0x2a5e
movq %r15, %rbp
movq %rbp, %rdi
callq 0x41fc
addq $0x8, %rbp
cmpq %r12, %rbp
jne 0x2a48
movq %r15, 0x8(%rsp)
movq %rsp, %r15
movq %r15, %rdi
callq 0x422e
leaq 0x68(%rsp), %r12
movl 0x48(%rsp), %ebx
jmp 0x2a8f
xorpd %xmm0, %xmm0
movapd %xmm0, 0xe0(%rsp)
xorl %r13d, %r13d
movq %rsp, %r15
movq %r15, %rdi
callq 0x4a14
movl 0x60(%rsp), %ebp
movl $0x2, %edi
movq %r15, %rsi
callq 0x2120
movq (%rsp), %rax
subq 0x98(%rsp), %rax
subq 0x50(%rsp), %r14
movq %r14, %rcx
addq 0x8(%rsp), %rcx
imulq $0x3b9aca00, %rax, %r14 # imm = 0x3B9ACA00
addq %rcx, %r14
incl %ebp
cmpl $0xa, %ebp
jne 0x2737
movq %r14, %rax
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
mulq %rcx
movq 0x70(%rsp), %rax
testq %rax, %rax
je 0x2b2a
addq $0x40, %rax
movq $-0x1, %rcx
movq (%rax), %rax
incq %rcx
testq %rax, %rax
jne 0x2af3
movq %rcx, %xmm0
punpckldq 0x3505(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x350d(%rip), %xmm0     # 0x6020
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, 0x150(%rsp)
jmp 0x2b37
xorpd %xmm0, %xmm0
movapd %xmm0, 0x150(%rsp)
shrq $0x3, %rdx
movq %rdx, 0x108(%rsp)
leaq 0x75f6(%rip), %r14      # 0xa140
movq (%r14), %rax
movq %rax, 0x100(%rsp)
leaq 0x75ec(%rip), %r15      # 0xa148
movq (%r15), %rax
movq %rax, 0x110(%rsp)
xorl %edi, %edi
leaq 0x160(%rsp), %rsi
callq 0x20c0
movq %r12, %rdi
callq 0x3626
xorl %ebp, %ebp
movq %rbp, (%r14)
movq %rbp, (%r15)
movl 0x90(%rsp), %eax
movq %rax, 0xf8(%rsp)
movq %rax, %rcx
movl $0xcccccccd, %eax       # imm = 0xCCCCCCCD
imulq %rax, %rcx
shrq $0x23, %rcx
movq %rcx, 0xb8(%rsp)
xorl %r14d, %r14d
movq %rsp, %r15
movl %ebx, 0x48(%rsp)
movq %rbp, 0x50(%rsp)
movl $0x2, %edi
movq %r15, %rsi
callq 0x2120
movq (%rsp), %rbp
movq 0x8(%rsp), %r12
cmpl $0x1, %ebx
movq %r12, 0x98(%rsp)
movq %rbp, 0x60(%rsp)
je 0x2c9e
xorpd %xmm0, %xmm0
movapd %xmm0, 0xa0(%rsp)
testl %ebx, %ebx
jne 0x2e9a
xorpd %xmm0, %xmm0
movapd %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq %r15, %rdi
movq 0x90(%rsp), %r15
movq %r15, %rsi
callq 0x40b4
testl %r15d, %r15d
je 0x2e9f
movl %r15d, %ebp
xorl %r15d, %r15d
movl $0x420, %edi            # imm = 0x420
callq 0x2140
leaq 0x74fe(%rip), %rcx      # 0xa140
incq (%rcx)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rax)
movq 0xd8(%rsp), %rcx
movq %rcx, (%rax)
movq %rax, 0x68(%rsp)
movq $0x1, 0x8(%rax)
movq %rsp, %rdi
leaq 0x68(%rsp), %rbx
movq %rbx, %rsi
callq 0x41d2
movq 0x8(%rsp), %r12
subq (%rsp), %r12
sarq $0x3, %r12
cmpq %r12, %r15
cmovaq %r15, %r12
movq %rbx, %rdi
callq 0x41fc
movq %r12, %r15
decl %ebp
jne 0x2c31
jmp 0x2ea2
leaq 0x30(%rsp), %rax
movq %rax, (%rsp)
movq $0x1, 0x8(%rsp)
xorpd %xmm0, %xmm0
leaq 0x10(%rsp), %rax
movupd %xmm0, (%rax)
movl $0x3f800000, 0x20(%rsp) # imm = 0x3F800000
movupd %xmm0, 0x18(%rax)
movq %r15, %rdi
movq 0xb8(%rsp), %rsi
callq 0x45ae
movq 0x90(%rsp), %r15
testl %r15d, %r15d
je 0x2eda
xorl %r12d, %r12d
movq $0x0, 0xa0(%rsp)
xorl %ebp, %ebp
movl $0x420, %edi            # imm = 0x420
callq 0x2140
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rax)
movq 0xd8(%rsp), %rcx
movq %rcx, (%rax)
leaq 0x741f(%rip), %rcx      # 0xa140
incq (%rcx)
movq %rax, 0x40(%rsp)
movq $0x1, 0x8(%rax)
imull $0x3e0f83e1, %ebp, %eax # imm = 0x3E0F83E1
cmpl $0x7c1f07d, %eax        # imm = 0x7C1F07D
jb 0x2e56
movl %ebp, 0x88(%rsp)
movq %rsp, %rdi
leaq 0x88(%rsp), %rsi
callq 0x4788
movq 0x40(%rsp), %rcx
testq %rcx, %rcx
je 0x2d67
incq 0x8(%rcx)
movq (%rax), %rdx
movq %rdx, 0x68(%rsp)
movq %rcx, (%rax)
leaq 0x68(%rsp), %rdi
callq 0x41fc
imull $0x8c13521d, %ebp, %eax # imm = 0x8C13521D
cmpl $0x4d4873f, %eax        # imm = 0x4D4873F
jb 0x2deb
movl %ebp, %eax
movq %rax, %rcx
movl $0xcccccccd, %edx       # imm = 0xCCCCCCCD
imulq %rdx, %rcx
shrq $0x25, %rcx
shll $0x3, %ecx
leal (%rcx,%rcx,4), %ecx
movl %ebp, %edx
subl %ecx, %edx
je 0x2deb
imulq $0x24924925, %rax, %rcx # imm = 0x24924925
shrq $0x20, %rcx
movl %ebp, %edx
subl %ecx, %edx
shrl %edx
addl %ecx, %edx
shrl $0x2, %edx
leal (,%rdx,8), %ecx
subl %ecx, %edx
addl %ebp, %edx
je 0x2deb
imulq $0x8421085, %rax, %rax  # imm = 0x8421085
shrq $0x20, %rax
movl %ebp, %ecx
subl %eax, %ecx
shrl %ecx
addl %eax, %ecx
shrl $0x4, %ecx
movl %ecx, %eax
shll $0x5, %eax
subl %eax, %ecx
addl %ebp, %ecx
jne 0x2e4a
leal -0x1(%rbp), %edi
movslq %edi, %rax
movq (%rsp), %rsi
movq 0x8(%rsp), %r8
xorl %edx, %edx
divq %r8
movq (%rsi,%rdx,8), %rax
testq %rax, %rax
je 0x2e4a
movq %rdx, %rcx
movq (%rax), %r9
cmpl 0x8(%r9), %edi
je 0x2e31
movq (%r9), %r9
testq %r9, %r9
je 0x2e4a
movslq 0x8(%r9), %rsi
movq %rsi, %rax
xorl %edx, %edx
divq %r8
cmpq %rcx, %rdx
jne 0x2e4a
cmpl %esi, %edi
jne 0x2e14
movl %edi, 0x68(%rsp)
movq %rsp, %rdi
leaq 0x68(%rsp), %rsi
callq 0x491e
incq 0xa0(%rsp)
movq 0x18(%rsp), %rax
cmpq %rax, %r12
cmovbeq %rax, %r12
leaq 0x40(%rsp), %rdi
callq 0x41fc
incl %ebp
cmpl %r15d, %ebp
jne 0x2cfc
movsd 0xa0(%rsp), %xmm0
unpcklps 0x3195(%rip), %xmm0     # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x319d(%rip), %xmm0     # 0x6020
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, 0xa0(%rsp)
jmp 0x2eea
xorl %r12d, %r12d
jmp 0x2ef5
xorl %r12d, %r12d
movq (%rsp), %r15
movq 0x8(%rsp), %rbx
cmpq %r15, %rbx
je 0x2ec9
movq %r15, %rbp
movq %rbp, %rdi
callq 0x41fc
addq $0x8, %rbp
cmpq %rbx, %rbp
jne 0x2eb3
movq %r15, 0x8(%rsp)
movq %rsp, %r15
movq %r15, %rdi
callq 0x422e
movl 0x48(%rsp), %ebx
jmp 0x2ef5
xorpd %xmm0, %xmm0
movapd %xmm0, 0xa0(%rsp)
xorl %r12d, %r12d
movq %rsp, %r15
movq %r15, %rdi
callq 0x4a14
movq 0x50(%rsp), %rbp
movl $0x2, %edi
movq %r15, %rsi
callq 0x2120
movq (%rsp), %rax
subq 0x60(%rsp), %rax
subq 0x98(%rsp), %r14
movq %r14, %rcx
addq 0x8(%rsp), %rcx
imulq $0x3b9aca00, %rax, %r14 # imm = 0x3B9ACA00
addq %rcx, %r14
incl %ebp
cmpl $0xa, %ebp
jne 0x2bb7
movq %r14, %rax
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
mulq %rcx
movq %rdx, %r14
leaq 0x71f1(%rip), %rax      # 0xa140
movq (%rax), %r15
leaq 0x71ef(%rip), %rax      # 0xa148
movq (%rax), %rbx
xorl %edi, %edi
leaq 0x1f0(%rsp), %rsi
callq 0x20c0
cmpq $0x0, 0x58(%rsp)
je 0x2fcc
movq %rbx, 0x98(%rsp)
movq 0xd0(%rsp), %rax
leaq 0x1(%rax), %rbp
movl $0x1, %ebx
cmpq $0x9, %rax
jb 0x2fe6
movl $0x4, %ebx
movl %ebp, %eax
movl $0xd1b71759, %edx       # imm = 0xD1B71759
cmpl $0x63, %eax
jbe 0x2fdf
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x2fe4
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x2fe6
movl %eax, %ecx
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %ebx
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x2f9e
addl $-0x3, %ebx
jmp 0x2fe6
movq 0xd0(%rsp), %rax
incq %rax
movq %rax, %rcx
jmp 0x3376
addl $-0x2, %ebx
jmp 0x2fe6
decl %ebx
movq %r15, 0x60(%rsp)
movl %ebx, %esi
leaq 0x78(%rsp), %rax
movq %rax, 0x68(%rsp)
leaq 0x68(%rsp), %r15
movq %r15, %rdi
movl $0x2d, %edx
callq 0x2180
movq 0x68(%rsp), %rdi
movl %ebx, %esi
movl %ebp, %edx
callq 0x3670
movl $0x4, %r8d
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x3090(%rip), %rcx      # 0x60bb
callq 0x2160
leaq 0x10(%rsp), %rbx
movq %rbx, (%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3056
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x305e
movupd (%rcx), %xmm0
movupd %xmm0, (%rbx)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq (%rsp), %rsi
movq 0x58(%rsp), %rdi
callq 0x4c3f
movq (%rsp), %rdi
cmpq %rbx, %rdi
je 0x3092
callq 0x2130
movq %rbp, 0x90(%rsp)
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x30ae
callq 0x2130
shrq $0x3, %r14
movl 0x118(%rsp), %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movq 0x58(%rsp), %rbx
movq %rbx, %rdi
leaq 0x2ff0(%rip), %rsi      # 0x60c0
callq 0x4ddf
movl 0x120(%rsp), %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movq %rbx, %rdi
leaq 0x2fdf(%rip), %rsi      # 0x60cd
callq 0x4ddf
xorps %xmm0, %xmm0
cvtsi2sdq 0xf8(%rsp), %xmm0
movsd %xmm0, 0x50(%rsp)
movq %rbx, %rdi
leaq 0x2fca(%rip), %rsi      # 0x60da
callq 0x4ddf
movq %rbx, %rdi
leaq 0x2fc5(%rip), %rsi      # 0x60e4
callq 0x4c3f
xorps %xmm0, %xmm0
cvtsi2sdq 0x108(%rsp), %xmm0
movsd %xmm0, 0x48(%rsp)
movq %rbx, %rdi
leaq 0x2fb8(%rip), %r15      # 0x60f9
movq %r15, %rsi
callq 0x4ddf
movsd 0x48(%rsp), %xmm0
divsd 0x50(%rsp), %xmm0
movq %rbx, %rdi
leaq 0x2fa8(%rip), %rbp      # 0x6107
movq %rbp, %rsi
callq 0x4ddf
movq %rbx, %rdi
leaq 0x2fad(%rip), %rsi      # 0x611e
movaps 0xe0(%rsp), %xmm0
callq 0x4ddf
movq %r13, %xmm1
movq 0x2e85(%rip), %xmm0     # 0x6010
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movapd 0x2e89(%rip), %xmm0     # 0x6020
subpd %xmm0, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq %rbx, %rdi
leaq 0x2f7d(%rip), %r13      # 0x612e
movq %r13, %rsi
callq 0x4ddf
xorps %xmm0, %xmm0
cvtsi2sdq 0x180(%rsp), %xmm0
movq %rbx, %rdi
leaq 0x2f6f(%rip), %rsi      # 0x613f
callq 0x4ddf
movsd 0x100(%rsp), %xmm1
unpcklps 0x2e2b(%rip), %xmm1     # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x2e33(%rip), %xmm1     # 0x6020
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq %rbx, %rdi
leaq 0x2f44(%rip), %rsi      # 0x6147
callq 0x4ddf
movsd 0x110(%rsp), %xmm1
unpcklps 0x2df8(%rip), %xmm1     # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x2e00(%rip), %xmm1     # 0x6020
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq %rbx, %rdi
leaq 0x2f1c(%rip), %rsi      # 0x6152
callq 0x4ddf
movq %rbx, %rdi
leaq 0x2f18(%rip), %rsi      # 0x615d
movaps 0x150(%rsp), %xmm0
callq 0x4ddf
movq %rbx, %rdi
callq 0x4c96
movq %rbx, %rdi
leaq 0x2f07(%rip), %rsi      # 0x616b
callq 0x4c3f
xorps %xmm0, %xmm0
cvtsi2sd %r14, %xmm0
movsd %xmm0, 0x48(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4ddf
movsd 0x48(%rsp), %xmm0
divsd 0x50(%rsp), %xmm0
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x4ddf
movq %rbx, %rdi
leaq 0x2e7b(%rip), %rsi      # 0x611e
movaps 0xa0(%rsp), %xmm0
callq 0x4ddf
movq %r12, %xmm1
punpckldq 0x2d53(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x2d5b(%rip), %xmm1     # 0x6020
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq %rbx, %rdi
movq %r13, %rsi
callq 0x4ddf
xorps %xmm0, %xmm0
cvtsi2sdq 0x210(%rsp), %xmm0
movq %rbx, %rdi
leaq 0x2e4c(%rip), %rsi      # 0x613f
callq 0x4ddf
movsd 0x60(%rsp), %xmm1
unpcklps 0x2d0b(%rip), %xmm1     # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x2d13(%rip), %xmm1     # 0x6020
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq %rbx, %rdi
leaq 0x2e24(%rip), %rsi      # 0x6147
callq 0x4ddf
movsd 0x98(%rsp), %xmm1
unpcklps 0x2cd8(%rip), %xmm1     # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x2ce0(%rip), %xmm1     # 0x6020
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq %rbx, %rdi
leaq 0x2dfc(%rip), %rsi      # 0x6152
callq 0x4ddf
movq %rbx, %rdi
callq 0x4c96
movq %rbx, %rdi
callq 0x4c96
movq 0x90(%rsp), %rcx
movq %rcx, %rax
movq 0xc8(%rsp), %r15
cmpq 0xf0(%rsp), %rcx
leaq 0x170(%rsp), %r14
leaq 0x68(%rsp), %r12
jne 0x2698
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x33ad
callq 0x4c96
movq 0x58(%rsp), %rdi
movl $0x1, %ebx
testb $0x1, 0xc0(%rsp)
movl $0x0, %eax
jne 0x24a7
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3295(%rip), %rdi      # 0x6673
leaq 0x329c(%rip), %rsi      # 0x6681
leaq 0x32b1(%rip), %rcx      # 0x669d
movl $0x85, %edx
callq 0x20d0
leaq 0x3276(%rip), %rdi      # 0x6673
leaq 0x327d(%rip), %rsi      # 0x6681
leaq 0x3292(%rip), %rcx      # 0x669d
movl $0x72, %edx
callq 0x20d0
movq %rax, %rbx
movq 0x160(%rsp), %rdi
cmpq %r14, %rdi
je 0x342f
callq 0x2130
jmp 0x342f
movq %rax, %rbx
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x3448
callq 0x2130
jmp 0x3448
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
jmp 0x3493
movq %rax, %rbx
jmp 0x3562
movq %rax, %rbx
movq 0x160(%rsp), %rdi
cmpq %r14, %rdi
jne 0x349c
jmp 0x3562
movq %rax, %rbx
jmp 0x3489
movq %rbx, %rcx
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %rcx, %rdi
je 0x3489
callq 0x2130
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x3562
callq 0x2130
jmp 0x3562
jmp 0x34d3
movq %rax, %rbx
movq 0x140(%rsp), %rax
testq %rax, %rax
je 0x3562
leaq 0x130(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x3562
movq %rax, %rdi
callq 0x3665
jmp 0x3508
jmp 0x3524
jmp 0x354d
jmp 0x3531
jmp 0x34e7
jmp 0x34f6
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x41fc
jmp 0x3527
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x41fc
jmp 0x3550
movq %rax, %rbx
jmp 0x351a
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x41fc
movq %rsp, %rdi
callq 0x422e
jmp 0x3562
movq %rax, %rbx
movq %rsp, %rdi
callq 0x4a14
jmp 0x3562
movq %rax, %rbx
jmp 0x3543
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x41fc
movq %rsp, %rdi
callq 0x422e
jmp 0x3558
movq %rax, %rbx
movq %rsp, %rdi
callq 0x4a14
leaq 0x68(%rsp), %rdi
callq 0x3626
movq %rbx, %rdi
callq 0x2210