// File: /workspace/github_c_makefile_star2_O3/aremmell[P]libsir/tests/tests.c
// Function: sirtest_perf
bool sirtest_perf(void) {
    static const char* logbasename = "libsir-perf";
    static const char* logext      = "";

#if !defined(DUMA)
# if !defined(SIR_PERF_PROFILE)
#  if !defined(__WIN__)
    static const size_t perflines = 1000000;
#  else
    static const size_t perflines = 100000;
#  endif
# else
    static const size_t perflines = 4000000;
# endif
#else /* DUMA */
    static const size_t perflines = 100000;
#endif

    INIT_N(si, SIRL_ALL, SIRO_NOMSEC | SIRO_NOHOST, 0, 0, "perf");
    bool pass = si_init;

    if (pass) {
        double stdioelapsed  = 0.0;
        double fileelapsed   = 0.0;
#if !defined(SIR_PERF_PROFILE)
        double printfelapsed = 0.0;

        TEST_MSG(SIR_BLUE("%zu lines printf..."), perflines);

        sir_time printftimer = {0};
        sir_timer_start(&printftimer);

        for (size_t n = 0; n < perflines; n++)
            (void)printf(SIR_WHITE("%.2f: lorem ipsum foo bar %s: %zu") SIR_EOL,
                sir_timer_elapsed(&printftimer), "baz", 1234 + n);

        printfelapsed = sir_timer_elapsed(&printftimer);
#endif

        TEST_MSG(SIR_BLUE("%zu lines libsir (stdout)..."), perflines);

        sir_time stdiotimer = {0};
        sir_timer_start(&stdiotimer);

        for (size_t n = 0; n < perflines; n++)
            (void)sir_debug("%.2f: lorem ipsum foo bar %s: %zu",
                sir_timer_elapsed(&stdiotimer), "baz", 1234 + n);

        stdioelapsed = sir_timer_elapsed(&stdiotimer);

        _sir_eqland(pass, sir_cleanup());

        INIT(si2, 0, 0, 0, 0);
        _sir_eqland(pass, si2_init);

        char logfilename[SIR_MAXPATH] = {0};
        (void)snprintf(logfilename, SIR_MAXPATH, MAKE_LOG_NAME("%s%s"), logbasename, logext);

        sirfileid logid = sir_addfile(logfilename, SIRL_ALL, SIRO_NOMSEC | SIRO_NONAME);
        _sir_eqland(pass, 0 != logid);

        if (pass) {
            TEST_MSG(SIR_BLUE("%zu lines libsir (file)..."), perflines);

            sir_time filetimer = {0};
            sir_timer_start(&filetimer);

            for (size_t n = 0; n < perflines; n++)
                (void)sir_debug("lorem ipsum foo bar %s: %zu", "baz", 1234 + n);

            fileelapsed = sir_timer_elapsed(&filetimer);

            _sir_eqland(pass, sir_remfile(logid));
        }

        if (pass) {
#if !defined(SIR_PERF_PROFILE)
            TEST_MSG(SIR_WHITEB("printf: ") SIR_CYAN("%zu lines in %.3fsec (%.1f lines/sec)"),
                perflines, printfelapsed / 1e3, (double)perflines / (printfelapsed / 1e3));
#endif
            TEST_MSG(SIR_WHITEB("libsir (stdout): ")
                   SIR_CYAN("%zu lines in %.3fsec (%.1f lines/sec)"), perflines,
                    stdioelapsed / 1e3, (double)perflines / (stdioelapsed / 1e3));

            TEST_MSG(SIR_WHITEB("libsir (file): ")
                   SIR_CYAN("%zu lines in %.3fsec (%.1f lines/sec)"), perflines,
                    fileelapsed / 1e3, (double)perflines / (fileelapsed / 1e3));

            TEST_MSG(SIR_WHITEB("timer resolution: ") SIR_CYAN("~%ldnsec"), sir_timer_getres());
        }
    }

    unsigned deleted = 0U;
    (void)enumfiles(SIR_TESTLOGDIR, logbasename, !cl_cfg.leave_logs, &deleted);

    if (deleted > 0U)
        TEST_MSG(SIR_DGRAY("deleted %u log file(s)"), deleted);

    _sir_eqland(pass, sir_cleanup());
    return PRINT_RESULT_RETURN(pass);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1278, %rsp           # imm = 0x1278
leaq 0x60(%rsp), %rbx
xorl %r15d, %r15d
movl $0x108, %edx            # imm = 0x108
movq %rbx, %rdi
xorl %esi, %esi
callq 0x31f0
movl $0x600, 0x4(%rbx)       # imm = 0x600
movw $0xff, (%rbx)
movl $0x100000, 0xc(%rbx)    # imm = 0x100000
leaq 0x148(%rsp), %rdi
leaq 0xa056(%rip), %rdx      # 0x112f4
movl $0x20, %esi
movl $0x20, %ecx
callq 0xc874
movq %rbx, %rdi
callq 0x9a21
testb %al, %al
je 0x75b4
leaq 0xbcce(%rip), %rsi      # 0x12f92
movl $0xf4240, %edx          # imm = 0xF4240
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
xorpd %xmm0, %xmm0
leaq 0x40(%rsp), %rbx
movapd %xmm0, (%rbx)
xorl %edi, %edi
movq %rbx, %rsi
callq 0xdff1
movl $0x4d2, %r14d           # imm = 0x4D2
leaq 0x270(%rsp), %r15
leaq 0xbcbb(%rip), %r12      # 0x12fbc
leaq 0xc48e(%rip), %r13      # 0x13796
movq %rbx, %rdi
movq %r15, %rsi
callq 0xdff1
movl $0x1, %edi
movq %r12, %rsi
movq %r13, %rdx
movq %r14, %rcx
movb $0x1, %al
callq 0x3400
incq %r14
cmpq $0xf4712, %r14          # imm = 0xF4712
jne 0x7308
leaq 0x40(%rsp), %rdi
leaq 0x270(%rsp), %rbx
movq %rbx, %rsi
callq 0xdff1
movsd %xmm0, 0x18(%rsp)
leaq 0xbc9d(%rip), %rsi      # 0x12ff3
movl $0xf4240, %edx          # imm = 0xF4240
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
xorpd %xmm0, %xmm0
leaq 0x30(%rsp), %r14
movapd %xmm0, (%r14)
xorl %edi, %edi
movq %r14, %rsi
callq 0xdff1
movl $0x4d2, %r15d           # imm = 0x4D2
leaq 0xbc9a(%rip), %r12      # 0x13026
leaq 0xc403(%rip), %r13      # 0x13796
movq %r14, %rdi
movq %rbx, %rsi
callq 0xdff1
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rdx
movb $0x1, %al
callq 0x9a45
incq %r15
cmpq $0xf4712, %r15          # imm = 0xF4712
jne 0x7393
leaq 0x30(%rsp), %rdi
leaq 0x270(%rsp), %rsi
callq 0xdff1
movsd %xmm0, 0x10(%rsp)
callq 0x9a26
movl %eax, %ebp
leaq 0x168(%rsp), %rbx
xorl %r15d, %r15d
movl $0x108, %edx            # imm = 0x108
movq %rbx, %rdi
xorl %esi, %esi
callq 0x31f0
movl $0x100000, %eax         # imm = 0x100000
movl %eax, 0x4(%rbx)
movl %eax, 0xc(%rbx)
movq %rbx, %rdi
callq 0x9a21
movl %eax, %r14d
leaq 0x270(%rsp), %rbx
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rdi
xorl %esi, %esi
callq 0x31f0
leaq 0x9ea0(%rip), %rax      # 0x112c7
movq %rax, (%rsp)
leaq 0xbc16(%rip), %r8       # 0x13048
leaq 0xbb4d(%rip), %r9       # 0x12f86
movl $0x1000, %esi           # imm = 0x1000
movl $0x1000, %ecx           # imm = 0x1000
movq %rbx, %rdi
movl $0x1, %edx
xorl %eax, %eax
callq 0x3040
movq %rbx, %rdi
movl $0xff, %esi
movl $0x1200, %edx           # imm = 0x1200
callq 0xa035
movl %eax, %ebx
testl %eax, %eax
setne %al
andb %bpl, %r14b
andb %al, %r14b
cmpb $0x1, %r14b
jne 0x75b4
leaq 0xbbd2(%rip), %rsi      # 0x13054
movl $0xf4240, %edx          # imm = 0xF4240
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
xorpd %xmm0, %xmm0
leaq 0x20(%rsp), %rsi
movapd %xmm0, (%rsi)
xorl %edi, %edi
callq 0xdff1
movl $0x4d2, %r14d           # imm = 0x4D2
leaq 0xbb78(%rip), %r15      # 0x1302c
leaq 0xc2db(%rip), %r12      # 0x13796
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x9a45
incq %r14
cmpq $0xf4712, %r14          # imm = 0xF4712
jne 0x74bb
leaq 0x20(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0xdff1
movsd %xmm0, 0x8(%rsp)
movl %ebx, %edi
callq 0xa03a
testb %al, %al
je 0x75b1
movsd 0x18(%rsp), %xmm0
divsd 0x9aff(%rip), %xmm0     # 0x11008
movsd 0x9fff(%rip), %xmm1     # 0x11510
divsd %xmm0, %xmm1
leaq 0xbb69(%rip), %rsi      # 0x13085
movl $0xf4240, %edx          # imm = 0xF4240
movl $0x1, %edi
movb $0x2, %al
callq 0x3400
movsd 0x10(%rsp), %xmm0
divsd 0x9acd(%rip), %xmm0     # 0x11008
movsd 0x9fcd(%rip), %xmm1     # 0x11510
divsd %xmm0, %xmm1
leaq 0xbb8f(%rip), %rsi      # 0x130dd
movl $0xf4240, %edx          # imm = 0xF4240
movl $0x1, %edi
movb $0x2, %al
callq 0x3400
movsd 0x8(%rsp), %xmm0
divsd 0x9a9b(%rip), %xmm0     # 0x11008
movsd 0x9f9b(%rip), %xmm1     # 0x11510
divsd %xmm0, %xmm1
leaq 0xbbbe(%rip), %rsi      # 0x1313e
movl $0xf4240, %edx          # imm = 0xF4240
movl $0x1, %edi
movb $0x2, %al
callq 0x3400
callq 0x3fb8
leaq 0xbc00(%rip), %rsi      # 0x1319d
movl $0x1, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0x3400
movb $0x1, %r15b
jmp 0x75b4
xorl %r15d, %r15d
leaq 0x270(%rsp), %rbx
movl $0x0, (%rbx)
movzbl 0x1432f(%rip), %edx     # 0x1b8f8
xorl $0x1, %edx
leaq 0xbc0f(%rip), %rdi      # 0x131e2
leaq 0xb9ac(%rip), %rsi      # 0x12f86
movq %rbx, %rcx
callq 0x417b
movl (%rbx), %edx
testl %edx, %edx
je 0x75fb
leaq 0xbbfb(%rip), %rsi      # 0x131ea
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
callq 0x9a26
andb %al, %r15b
movzbl %r15b, %edi
xorl %esi, %esi
callq 0x3b6d
addq $0x1278, %rsp           # imm = 0x1278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq