// File: /workspace/github_c_makefile_star2_O2/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 $0x1268, %rsp           # imm = 0x1268
leaq 0x50(%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 0x138(%rsp), %rdi
leaq 0x9270(%rip), %rdx      # 0x102f4
pushq $0x20
popq %rcx
movq %rcx, %rsi
callq 0xc015
movq %rbx, %rdi
callq 0x94a9
testb %al, %al
je 0x7356
leaq 0xaeac(%rip), %rsi      # 0x11f52
xorl %r13d, %r13d
pushq $0x1
popq %rbx
movl $0xf4240, %ebp          # imm = 0xF4240
movl $0xf4240, %edx          # imm = 0xF4240
movl %ebx, %edi
xorl %eax, %eax
callq 0x3410
xorpd %xmm0, %xmm0
leaq 0x40(%rsp), %r14
movapd %xmm0, (%r14)
movq %r14, %rdi
callq 0x4309
leaq 0xaea0(%rip), %r15      # 0x11f7c
leaq 0xb673(%rip), %r12      # 0x12756
movq %r14, %rdi
callq 0x4313
subq $0x1, %rbp
jb 0x710c
leaq 0x4d2(%r13), %rcx
movl %ebx, %edi
movq %r15, %rsi
movq %r12, %rdx
movb $0x1, %al
callq 0x3410
incq %r13
jmp 0x70e3
movsd %xmm0, 0x18(%rsp)
leaq 0xae9a(%rip), %rsi      # 0x11fb3
xorl %r12d, %r12d
pushq $0x1
popq %rdi
movl $0xf4240, %r13d         # imm = 0xF4240
movl $0xf4240, %edx          # imm = 0xF4240
xorl %eax, %eax
callq 0x3410
xorpd %xmm0, %xmm0
leaq 0x30(%rsp), %rbx
movapd %xmm0, (%rbx)
movq %rbx, %rdi
callq 0x4309
leaq 0xae99(%rip), %r14      # 0x11fe6
leaq 0xb602(%rip), %r15      # 0x12756
movq %rbx, %rdi
callq 0x4313
subq $0x1, %r13
jb 0x717c
leaq 0x4d2(%r12), %rdx
movq %r14, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x94cd
incq %r12
jmp 0x7154
movsd %xmm0, 0x10(%rsp)
callq 0x94ae
movl %eax, %ebp
leaq 0x158(%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 0x94a9
movl %eax, %r14d
leaq 0x260(%rsp), %rbx
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rdi
xorl %esi, %esi
callq 0x31f0
leaq 0x90f0(%rip), %rax      # 0x102c7
movq %rax, (%rsp)
leaq 0xae26(%rip), %r8       # 0x12008
leaq 0xad5d(%rip), %r9       # 0x11f46
pushq $0x1
popq %rdx
movl $0x1000, %esi           # imm = 0x1000
movl $0x1000, %ecx           # imm = 0x1000
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3040
movq %rbx, %rdi
movl $0xff, %esi
movl $0x1200, %edx           # imm = 0x1200
callq 0x9a6b
movl %eax, %ebx
testl %eax, %eax
setne %al
andb %bpl, %r14b
andb %al, %r14b
cmpb $0x1, %r14b
jne 0x7356
leaq 0xade4(%rip), %rsi      # 0x12014
pushq $0x1
popq %rdi
movl $0xf4240, %r12d         # imm = 0xF4240
movl $0xf4240, %edx          # imm = 0xF4240
xorl %eax, %eax
callq 0x3410
xorpd %xmm0, %xmm0
leaq 0x20(%rsp), %rdi
movapd %xmm0, (%rdi)
callq 0x4309
leaq 0xad8e(%rip), %r14      # 0x11fec
leaq 0xb4f1(%rip), %r15      # 0x12756
xorl %r13d, %r13d
subq $0x1, %r12
jb 0x7287
leaq 0x4d2(%r13), %rdx
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x94cd
incq %r13
jmp 0x7268
leaq 0x20(%rsp), %rdi
callq 0x4313
movsd %xmm0, 0x8(%rsp)
movl %ebx, %edi
callq 0x9a70
testb %al, %al
je 0x7353
movsd 0x18(%rsp), %xmm0
divsd 0x8d54(%rip), %xmm0     # 0x10008
movsd 0x9214(%rip), %xmm1     # 0x104d0
divsd %xmm0, %xmm1
leaq 0xad7e(%rip), %rsi      # 0x12045
pushq $0x1
popq %rbx
movl $0xf4240, %edx          # imm = 0xF4240
movl %ebx, %edi
movb $0x2, %al
callq 0x3410
movsd 0x10(%rsp), %xmm0
divsd 0x8d22(%rip), %xmm0     # 0x10008
movsd 0x91e2(%rip), %xmm1     # 0x104d0
divsd %xmm0, %xmm1
leaq 0xada4(%rip), %rsi      # 0x1209d
movl $0xf4240, %edx          # imm = 0xF4240
movl %ebx, %edi
movb $0x2, %al
callq 0x3410
movsd 0x8(%rsp), %xmm0
divsd 0x8cf3(%rip), %xmm0     # 0x10008
movsd 0x91b3(%rip), %xmm1     # 0x104d0
divsd %xmm0, %xmm1
leaq 0xadd6(%rip), %rsi      # 0x120fe
movl $0xf4240, %edx          # imm = 0xF4240
movl %ebx, %edi
movb $0x2, %al
callq 0x3410
callq 0x3ee2
leaq 0xae1b(%rip), %rsi      # 0x1215d
movl %ebx, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0x3410
movb $0x1, %r15b
jmp 0x7356
xorl %r15d, %r15d
leaq 0x260(%rsp), %rbx
andl $0x0, (%rbx)
movzbl 0x145a0(%rip), %edx     # 0x1b908
xorl $0x1, %edx
leaq 0xae30(%rip), %rdi      # 0x121a2
leaq 0xabcd(%rip), %rsi      # 0x11f46
movq %rbx, %rcx
callq 0x4094
movl (%rbx), %edx
testl %edx, %edx
je 0x7398
leaq 0xae1c(%rip), %rsi      # 0x121aa
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x3410
callq 0x94ae
andb %al, %r15b
movzbl %r15b, %edi
xorl %esi, %esi
callq 0x3ac9
addq $0x1268, %rsp           # imm = 0x1268
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq