// File: /workspace/github_c_makefile_star2_O1/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
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
movw $0x0, 0x8(%rbx)
leaq 0x148(%rsp), %rdi
leaq 0xa020(%rip), %rdx      # 0x112f4
movl $0x20, %esi
movl $0x20, %ecx
callq 0xc950
movq %rbx, %rdi
callq 0x9a31
movl %eax, %ebx
testb %al, %al
je 0x75ec
leaq 0xbc96(%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 0xe21a
movl $0x4d2, %r14d           # imm = 0x4D2
leaq 0x270(%rsp), %r15
leaq 0xbc83(%rip), %r12      # 0x12fbc
leaq 0xc456(%rip), %r13      # 0x13796
movq %rbx, %rdi
movq %r15, %rsi
callq 0xe21a
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 0x7340
leaq 0x40(%rsp), %rdi
leaq 0x270(%rsp), %rbx
movq %rbx, %rsi
callq 0xe21a
movsd %xmm0, 0x18(%rsp)
leaq 0xbc65(%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 0xe21a
movl $0x4d2, %r15d           # imm = 0x4D2
leaq 0xbc62(%rip), %r12      # 0x13026
leaq 0xc3cb(%rip), %r13      # 0x13796
movq %r14, %rdi
movq %rbx, %rsi
callq 0xe21a
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rdx
movb $0x1, %al
callq 0x9a55
incq %r15
cmpq $0xf4712, %r15          # imm = 0xF4712
jne 0x73cb
leaq 0x30(%rsp), %rdi
leaq 0x270(%rsp), %rsi
callq 0xe21a
movsd %xmm0, 0x10(%rsp)
callq 0x9a36
movl %eax, %r14d
leaq 0x168(%rsp), %rbx
xorl %ebp, %ebp
movl $0x108, %edx            # imm = 0x108
movq %rbx, %rdi
xorl %esi, %esi
callq 0x31f0
movl $0x100000, %eax         # imm = 0x100000
movl %eax, 0x4(%rbx)
movw %bp, (%rbx)
movl %eax, 0xc(%rbx)
movw %bp, 0x8(%rbx)
movq %rbx, %rdi
callq 0x9a31
movl %eax, %ebx
leaq 0x270(%rsp), %r15
movl $0x1000, %edx           # imm = 0x1000
movq %r15, %rdi
xorl %esi, %esi
callq 0x31f0
leaq 0x9e62(%rip), %rax      # 0x112c7
movq %rax, (%rsp)
leaq 0xbbd8(%rip), %r8       # 0x13048
leaq 0xbb0f(%rip), %r9       # 0x12f86
movl $0x1000, %esi           # imm = 0x1000
movl $0x1000, %ecx           # imm = 0x1000
movq %r15, %rdi
movl $0x1, %edx
xorl %eax, %eax
callq 0x3040
movq %r15, %rdi
movl $0xff, %esi
movl $0x1200, %edx           # imm = 0x1200
callq 0xa045
movl %eax, %ebp
testl %eax, %eax
setne %al
andb %r14b, %bl
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
andb %al, %bl
je 0x7533
leaq 0xbb93(%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 0xe21a
movl $0x4d2, %ebx            # imm = 0x4D2
leaq 0xbb3a(%rip), %r14      # 0x1302c
leaq 0xc29d(%rip), %r15      # 0x13796
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x9a55
incq %rbx
cmpq $0xf4712, %rbx          # imm = 0xF4712
jne 0x74f9
leaq 0x20(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0xe21a
movsd %xmm0, 0x8(%rsp)
movl %ebp, %edi
callq 0xa04a
movl %eax, %ebx
testb %bl, %bl
je 0x75ec
movsd 0x18(%rsp), %xmm0
divsd 0x9abf(%rip), %xmm0     # 0x11008
movsd 0x9fbf(%rip), %xmm1     # 0x11510
divsd %xmm0, %xmm1
leaq 0xbb29(%rip), %rsi      # 0x13085
movl $0xf4240, %edx          # imm = 0xF4240
movl $0x1, %edi
movb $0x2, %al
callq 0x3400
movsd 0x10(%rsp), %xmm0
divsd 0x9a8d(%rip), %xmm0     # 0x11008
movsd 0x9f8d(%rip), %xmm1     # 0x11510
divsd %xmm0, %xmm1
leaq 0xbb4f(%rip), %rsi      # 0x130dd
movl $0xf4240, %edx          # imm = 0xF4240
movl $0x1, %edi
movb $0x2, %al
callq 0x3400
movsd 0x8(%rsp), %xmm0
divsd 0x9a5b(%rip), %xmm0     # 0x11008
movsd 0x9f5b(%rip), %xmm1     # 0x11510
divsd %xmm0, %xmm1
leaq 0xbb7e(%rip), %rsi      # 0x1313e
movl $0xf4240, %edx          # imm = 0xF4240
movl $0x1, %edi
movb $0x2, %al
callq 0x3400
callq 0x3f62
leaq 0xbbc0(%rip), %rsi      # 0x1319d
movl $0x1, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0x3400
leaq 0x270(%rsp), %r14
movl $0x0, (%r14)
movzbl 0x142f6(%rip), %edx     # 0x1b8f8
xorl $0x1, %edx
leaq 0xbbd6(%rip), %rdi      # 0x131e2
leaq 0xb973(%rip), %rsi      # 0x12f86
movq %r14, %rcx
callq 0x412c
movl (%r14), %edx
testl %edx, %edx
je 0x7635
leaq 0xbbc1(%rip), %rsi      # 0x131ea
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
callq 0x9a36
andb %al, %bl
movzbl %bl, %edi
xorl %esi, %esi
callq 0x3b04
addq $0x1278, %rsp           # imm = 0x1278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq