// File: /workspace/github_c_makefile_star2_O1/aremmell[P]libsir/tests/tests.c
// Function: sirtest_squelchspam
bool sirtest_squelchspam(void) {
    INIT(si, SIRL_ALL, 0, 0, 0);
    bool pass = si_init;

    static const size_t alternate  = 50;
    static const size_t sequence[] = {
        1000, /* non-repeating messages. */
        1000, /* repeating messages. */
        1000, /* alternating repeating and non-repeating messages. */
        100   /* repeating messages, but on different levels. */
    };

    sir_time timer;
    sir_timer_start(&timer);

    TEST_MSG(SIR_BLUE("%zu non-repeating messages..."), sequence[0]);

    for (size_t n = 0, ascii_idx = 33; n < sequence[0]; n++, ascii_idx++) {
        _sir_eqland(pass, sir_debug("%c%c a non-repeating message", (char)ascii_idx,
            (char)ascii_idx + 1));

        if (ascii_idx == 125)
            ascii_idx = 33;
    }

    TEST_MSG(SIR_BLUE("%zu repeating messages..."), sequence[1]);

    for (size_t n = 0; n < sequence[1]; n++) {
        bool ret = sir_debug("a repeating message");

        if (n >= SIR_SQUELCH_THRESHOLD - 1)
            _sir_eqland(pass, !ret);
        else
            _sir_eqland(pass, ret);
    }

    TEST_MSG(SIR_BLUE("%zu alternating repeating and non-repeating messages..."),
        sequence[2]);

    bool repeating   = false;
    size_t counter   = 0;
    size_t repeat_id = 0;
    for (size_t n = 0, ascii_idx = 33; n < sequence[2]; n++, counter++, ascii_idx++) {
        if (!repeating) {
            _sir_eqland(pass, sir_debug("%c%c a non-repeating message", (char)ascii_idx,
                (char)ascii_idx + 1));
        } else {
            bool ret = sir_debug("%zu a repeating message", repeat_id);

            if (counter - 1 >= SIR_SQUELCH_THRESHOLD - 1)
                _sir_eqland(pass, !ret);
            else
                _sir_eqland(pass, ret);
        }

        if (counter == alternate) {
            repeating = !repeating;
            counter = 0;
            repeat_id++;
        }

        if (ascii_idx == 125)
            ascii_idx = 33;
    }

    TEST_MSG(SIR_BLUE("%zu repeating messages, but on different levels..."), sequence[3]);

    for (size_t n = 0; n < sequence[3]; n++) {
        if (n % 2 == 0)
            _sir_eqland(pass, sir_debug("a repeating message"));
        else
            _sir_eqland(pass, sir_info("a repeating message"));
    }

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
leaq 0x10(%rsp), %rbx
movl $0x108, %edx            # imm = 0x108
movq %rbx, %rdi
xorl %esi, %esi
callq 0x31f0
movl $0x100000, %eax         # imm = 0x100000
movl %eax, 0x4(%rbx)
movw $0xff, (%rbx)
movl %eax, 0xc(%rbx)
movw $0x0, 0x8(%rbx)
movq %rbx, %rdi
callq 0x9a31
movl %eax, %ebx
movq %rsp, %rsi
xorl %edi, %edi
callq 0xe21a
leaq 0xb2b3(%rip), %rsi      # 0x1392a
movl $0x3e8, %r15d           # imm = 0x3E8
movl $0x3e8, %edx            # imm = 0x3E8
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
movl $0x21, %r13d
leaq 0xb2c3(%rip), %r14      # 0x1395e
movl $0x22, %r12d
movsbl %r13b, %esi
leal 0x1(%rsi), %edx
movq %r14, %rdi
xorl %eax, %eax
callq 0x9a55
andb %al, %bl
cmpq $0x7d, %r13
leaq 0x1(%r13), %r13
cmoveq %r12, %r13
decq %r15
jne 0x86a1
leaq 0xb2af(%rip), %rsi      # 0x1397b
xorl %r15d, %r15d
movl $0x3e8, %edx            # imm = 0x3E8
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
leaq 0xb316(%rip), %r14      # 0x139fd
xorl %r12d, %r12d
movq %r14, %rdi
xorl %eax, %eax
callq 0x9a55
cmpq $0x4, %r12
setae %cl
xorb %al, %cl
movzbl %bl, %ebx
cmovel %r15d, %ebx
incq %r12
cmpq $0x3e8, %r12            # imm = 0x3E8
jne 0x86ea
leaq 0xb294(%rip), %rsi      # 0x139ab
movl $0x3e8, %ebp            # imm = 0x3E8
movl $0x3e8, %edx            # imm = 0x3E8
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
movl $0x21, %r13d
xorl %r12d, %r12d
xorl %r15d, %r15d
xorl %r14d, %r14d
testb $0x1, %r14b
je 0x8764
leaq 0xb2b0(%rip), %rdi      # 0x139f9
movq %r12, %rsi
xorl %eax, %eax
callq 0x9a55
movl %eax, %ecx
leaq -0x5(%r15), %rax
cmpq $-0x4, %rax
setb %al
xorb %cl, %al
jmp 0x8779
movsbl %r13b, %esi
leal 0x1(%rsi), %edx
leaq 0xb1ec(%rip), %rdi      # 0x1395e
xorl %eax, %eax
callq 0x9a55
movzbl %bl, %ebx
testb %al, %al
movl $0x0, %eax
cmovel %eax, %ebx
xorl %eax, %eax
cmpq $0x32, %r15
leaq 0x1(%r15), %r15
sete %al
movl $0x1, %ecx
cmoveq %rcx, %r15
xorb %al, %r14b
addq %rax, %r12
cmpq $0x7d, %r13
leaq 0x1(%r13), %r13
movl $0x22, %eax
cmoveq %rax, %r13
decq %rbp
jne 0x873c
leaq 0xb252(%rip), %rsi      # 0x13a11
xorl %r15d, %r15d
movl $0x64, %edx
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
leaq 0xb223(%rip), %r14      # 0x139fd
xorl %r12d, %r12d
movq %r14, %rdi
xorl %eax, %eax
testb $0x1, %r12b
jne 0x87ef
callq 0x9a55
jmp 0x87f4
callq 0x9b13
movzbl %bl, %ebx
testb %al, %al
cmovel %r15d, %ebx
incq %r12
cmpq $0x64, %r12
jne 0x87dd
callq 0x9a36
andb %bl, %al
movzbl %al, %edi
xorl %esi, %esi
callq 0x3b04
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq