// File: /workspace/github_c_makefile_star2_O2/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)
movq %rbx, %rdi
callq 0x94a9
movl %eax, %ebx
movq %rsp, %rdi
callq 0x4309
leaq 0xa6a3(%rip), %rsi      # 0x128ea
pushq $0x1
popq %rdi
movl $0x3e8, %r15d           # imm = 0x3E8
movl $0x3e8, %edx            # imm = 0x3E8
xorl %eax, %eax
callq 0x3410
pushq $0x21
popq %r12
leaq 0xa6b7(%rip), %r14      # 0x1291e
subq $0x1, %r15
jb 0x8292
movsbl %r12b, %esi
leal 0x1(%rsi), %edx
movq %r14, %rdi
xorl %eax, %eax
callq 0x94cd
andb %al, %bl
cmpq $0x7d, %r12
leaq 0x1(%r12), %r12
pushq $0x22
popq %rax
cmoveq %rax, %r12
jmp 0x8267
leaq 0xa6a2(%rip), %rsi      # 0x1293b
pushq $0x1
popq %rdi
movl $0x3e8, %edx            # imm = 0x3E8
xorl %eax, %eax
callq 0x3410
leaq 0xa70e(%rip), %r14      # 0x129bd
xorl %r15d, %r15d
cmpq $0x3e8, %r15            # imm = 0x3E8
je 0x82d5
movq %r14, %rdi
xorl %eax, %eax
callq 0x94cd
cmpq $0x4, %r15
setae %cl
xorb %al, %cl
andb %cl, %bl
incq %r15
jmp 0x82b2
leaq 0xa68f(%rip), %rsi      # 0x1296b
xorl %ebp, %ebp
pushq $0x1
popq %rdi
movl $0x3e8, %r14d           # imm = 0x3E8
movl $0x3e8, %edx            # imm = 0x3E8
xorl %eax, %eax
callq 0x3410
pushq $0x21
popq %r15
xorl %r13d, %r13d
xorl %r12d, %r12d
subq $0x1, %r14
jb 0x836d
testb $0x1, %bpl
je 0x832b
leaq 0xa6a9(%rip), %rdi      # 0x129b9
movq %r12, %rsi
xorl %eax, %eax
callq 0x94cd
movl %eax, %ecx
leaq -0x5(%r13), %rax
cmpq $-0x4, %rax
setb %al
xorb %cl, %al
jmp 0x8340
movsbl %r15b, %esi
leal 0x1(%rsi), %edx
leaq 0xa5e5(%rip), %rdi      # 0x1291e
xorl %eax, %eax
callq 0x94cd
andb %al, %bl
xorl %eax, %eax
cmpq $0x32, %r13
leaq 0x1(%r13), %r13
sete %al
pushq $0x1
popq %rcx
cmoveq %rcx, %r13
xorb %al, %bpl
addq %rax, %r12
cmpq $0x7d, %r15
leaq 0x1(%r15), %r15
pushq $0x22
popq %rax
cmoveq %rax, %r15
jmp 0x82fd
leaq 0xa65d(%rip), %rsi      # 0x129d1
pushq $0x1
popq %rdi
pushq $0x64
popq %rdx
xorl %eax, %eax
callq 0x3410
leaq 0xa635(%rip), %r14      # 0x129bd
xorl %r15d, %r15d
cmpq $0x64, %r15
je 0x83af
movq %r14, %rdi
xorl %eax, %eax
testb $0x1, %r15b
jne 0x83a3
callq 0x94cd
jmp 0x83a8
callq 0x95a2
andb %al, %bl
incq %r15
jmp 0x838b
callq 0x94ae
andb %bl, %al
movzbl %al, %edi
xorl %esi, %esi
callq 0x3ac9
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq