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

    char str[] = "Kneel  \f \n  before  \t \r \v  Zod!?";

    TEST_MSG_0(SIR_WHITEB("--- valid string utility usage ---"));

    _sir_eqland(pass, _sir_strsqueeze(str) && 0 == strncmp(str, "Kneel before Zod!?", 18));
    TEST_MSG("_sir_strsqueeze:            '%s'", str);

    _sir_eqland(pass, _sir_strremove(str, "!") && 0 == strncmp(str, "Kneel before Zod?", 17));
    TEST_MSG("_sir_strremove(\"!\"):        '%s'", str);

    _sir_eqland(pass, _sir_strreplace(str, '?', '.') && 0 == strncmp(str, "Kneel before Zod.", 17));
    TEST_MSG("_sir_strreplace(\"?\", \".\"):  '%s'", str);

    _sir_eqland(pass, 1 == _sir_strcreplace(str, '.', '!', 1) && 0 == strncmp(str, "Kneel before Zod!", 17));
    TEST_MSG("_sir_strcreplace(\".\", \"!\"): '%s'", str);

    _sir_eqland(pass, _sir_strredact(str, "e", '*') && 0 == strncmp(str, "Kn**l b*for* Zod!", 17));
    TEST_MSG("_sir_strredact(\"e\", \"*\"):   '%s'", str);

    _sir_eqland(pass, _sir_strredact(str, "X", 'Y') && 0 == strncmp(str, "Kn**l b*for* Zod!", 17));
    TEST_MSG("_sir_strredact(\"X\", \"Y\"):   '%s'", str);

    PASSFAIL_MSG(pass, "\t--- valid string utility usage: %s ---" SIR_EOL SIR_EOL, PRN_PASS(pass));

    TEST_MSG_0(SIR_WHITEB("--- invalid string utility usage - NULL pointer ---"));

    TEST_MSG_0("_sir_strsqueeze:  NULL pointer");
    _sir_eqland(pass, !_sir_strsqueeze(NULL));

    TEST_MSG_0("_sir_strremove:   NULL pointer");
    _sir_eqland(pass, !_sir_strremove(NULL, "sub"));

    TEST_MSG_0("_sir_strreplace:  NULL pointer");
    _sir_eqland(pass, !_sir_strreplace(NULL, 'c', 'n'));

    TEST_MSG_0("_sir_strcreplace: NULL pointer");
    _sir_eqland(pass, !_sir_strcreplace(NULL, 'c', 'n', -1));

    TEST_MSG_0("_sir_strredact:   NULL pointer");
    _sir_eqland(pass, !_sir_strredact(NULL, "s", '*'));

    PASSFAIL_MSG(pass, "\t--- invalid string utility usage - NULL pointer: %s ---" SIR_EOL SIR_EOL, PRN_PASS(pass));

    TEST_MSG_0(SIR_WHITEB("--- invalid string utility usage - bad parameters ---"));

    TEST_MSG_0("_sir_strremove:   bad parameter \"sub\"");
    _sir_eqland(pass, _sir_strremove(str, NULL));

    TEST_MSG_0("_sir_strreplace:  bad parameter 'c'");
    _sir_eqland(pass, _sir_strreplace(str, 0, 'n'));

    TEST_MSG_0("_sir_strreplace:  bad parameter 'n'");
    _sir_eqland(pass, _sir_strreplace(str, 'c', 0));

    TEST_MSG_0("_sir_strcreplace: bad parameter 'c'");
    _sir_eqland(pass, !_sir_strcreplace(str, 0, 'n', -1));

    TEST_MSG_0("_sir_strcreplace: bad parameter 'n'");
    _sir_eqland(pass, !_sir_strcreplace(str, 'c', 0, -1));

    TEST_MSG_0("_sir_strcreplace: bad parameter 'max'");
    _sir_eqland(pass, !_sir_strcreplace(str, 'c', 'n', 0));

    TEST_MSG_0("_sir_strredact:   bad parameter \"sub\"");
    _sir_eqland(pass, _sir_strredact(str, NULL, '*'));

    TEST_MSG_0("_sir_strredact:   bad parameter 'c'");
    _sir_eqland(pass, _sir_strredact(str, "sub", 0));

    PASSFAIL_MSG(pass, "\t--- invalid string utility usage - bad parameters: %s ---" SIR_EOL, PRN_PASS(pass));

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
leaq 0x50(%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 $0xff, (%rbx)
movl %eax, 0xc(%rbx)
movq %rbx, %rdi
callq 0x94a9
movl %eax, %ebx
movaps 0xb6ea(%rip), %xmm0     # 0x13e10
leaq 0x10(%rsp), %r14
movaps %xmm0, 0x10(%r14)
movaps 0xb6c9(%rip), %xmm0     # 0x13e00
movaps %xmm0, (%r14)
movb $0x0, 0x20(%r14)
leaq 0xa558(%rip), %rsi      # 0x12c9f
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x3410
movq %r14, %rdi
callq 0xc364
testq %rax, %rax
je 0x877b
leaq 0xa573(%rip), %rsi      # 0x12cd8
leaq 0x10(%rsp), %rdi
pushq $0x12
popq %rdx
callq 0x33e0
testl %eax, %eax
sete %bpl
andb %bl, %bpl
leaq 0xa569(%rip), %rsi      # 0x12ceb
xorl %r14d, %r14d
pushq $0x1
popq %rdi
leaq 0x10(%rsp), %rbx
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3410
leaq 0xa61f(%rip), %rsi      # 0x12dbd
movq %rbx, %rdi
callq 0xc2bf
testq %rax, %rax
je 0x87c8
leaq 0xa55c(%rip), %rsi      # 0x12d0e
leaq 0x10(%rsp), %rdi
pushq $0x11
popq %rdx
callq 0x33e0
testl %eax, %eax
sete %r14b
andb %bpl, %r14b
leaq 0xa551(%rip), %rsi      # 0x12d20
xorl %ebp, %ebp
pushq $0x1
popq %rdi
leaq 0x10(%rsp), %rbx
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3410
pushq $0x3f
popq %rsi
pushq $0x2e
popq %rdx
movq %rbx, %rdi
callq 0xc438
testq %rax, %rax
je 0x8813
leaq 0xa546(%rip), %rsi      # 0x12d43
leaq 0x10(%rsp), %rdi
pushq $0x11
popq %rdx
callq 0x33e0
testl %eax, %eax
sete %bpl
andb %r14b, %bpl
leaq 0xa53b(%rip), %rsi      # 0x12d55
xorl %r15d, %r15d
pushq $0x1
popq %rbx
leaq 0x10(%rsp), %r14
movl %ebx, %edi
movq %r14, %rdx
xorl %eax, %eax
callq 0x3410
pushq $0x2e
popq %rsi
pushq $0x21
popq %rdx
movq %r14, %rdi
movl %ebx, %ecx
callq 0xc47a
cmpq $0x1, %rax
jne 0x8864
leaq 0xa52a(%rip), %rsi      # 0x12d78
leaq 0x10(%rsp), %rdi
pushq $0x11
popq %rdx
callq 0x33e0
testl %eax, %eax
sete %r15b
andb %bpl, %r15b
leaq 0xa51f(%rip), %rsi      # 0x12d8a
xorl %ebp, %ebp
pushq $0x1
popq %rdi
leaq 0x10(%rsp), %rbx
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3410
leaq 0xbf64(%rip), %rsi      # 0x147ea
pushq $0x2a
popq %rdx
movq %rbx, %rdi
callq 0xc3c9
testq %rax, %rax
je 0x88b3
leaq 0xa510(%rip), %rsi      # 0x12dad
leaq 0x10(%rsp), %rdi
pushq $0x11
popq %rdx
callq 0x33e0
testl %eax, %eax
sete %bpl
andb %r15b, %bpl
leaq 0xa505(%rip), %rsi      # 0x12dbf
xorl %r15d, %r15d
pushq $0x1
popq %rdi
leaq 0x10(%rsp), %rbx
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3410
leaq 0xa50c(%rip), %rsi      # 0x12de2
pushq $0x59
popq %rdx
movq %rbx, %rdi
callq 0xc3c9
testq %rax, %rax
je 0x8903
leaq 0xa4c0(%rip), %rsi      # 0x12dad
leaq 0x10(%rsp), %rdi
pushq $0x11
popq %rdx
callq 0x33e0
testl %eax, %eax
sete %r15b
andb %bpl, %r15b
leaq 0xa4da(%rip), %rsi      # 0x12de4
pushq $0x1
popq %rbx
leaq 0x10(%rsp), %rdx
movl %ebx, %edi
xorl %eax, %eax
callq 0x3410
leaq 0xa4e5(%rip), %rax      # 0x12e07
leaq 0xa51c(%rip), %rsi      # 0x12e45
testb %r15b, %r15b
cmovneq %rax, %rsi
leaq 0x777f(%rip), %rax      # 0x100b6
leaq 0x7791(%rip), %rdx      # 0x100cf
cmovneq %rax, %rdx
movl %ebx, %edi
xorl %eax, %eax
callq 0x3410
leaq 0xa531(%rip), %rsi      # 0x12e83
movl %ebx, %edi
xorl %eax, %eax
callq 0x3410
leaq 0xa56b(%rip), %rsi      # 0x12ecd
movl %ebx, %edi
xorl %eax, %eax
callq 0x3410
xorl %edi, %edi
callq 0xc364
movq %rax, 0x8(%rsp)
leaq 0xa570(%rip), %rsi      # 0x12eee
movl %ebx, %edi
xorl %eax, %eax
callq 0x3410
leaq 0xa581(%rip), %rsi      # 0x12f0f
xorl %edi, %edi
callq 0xc2bf
movq %rax, %r13
leaq 0xa574(%rip), %rsi      # 0x12f13
movl %ebx, %edi
xorl %eax, %eax
callq 0x3410
pushq $0x63
popq %r14
pushq $0x6e
popq %r12
xorl %edi, %edi
movl %r14d, %esi
movl %r12d, %edx
callq 0xc438
movq %rax, %rbp
leaq 0xa56d(%rip), %rsi      # 0x12f34
movl %ebx, %edi
xorl %eax, %eax
callq 0x3410
pushq $-0x1
popq %rcx
xorl %edi, %edi
movl %r14d, %esi
movl %r12d, %edx
callq 0xc47a
testq %rax, %rax
sete %r14b
leaq 0xa567(%rip), %rsi      # 0x12f55
movl %ebx, %edi
xorl %eax, %eax
callq 0x3410
leaq 0x782b(%rip), %rsi      # 0x10229
pushq $0x2a
popq %rdx
xorl %edi, %edi
callq 0xc3c9
movq %rbp, %xmm0
movq %rax, %xmm1
punpcklqdq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0]
movq %r13, %xmm0
movq 0x8(%rsp), %xmm2
punpcklqdq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0]
por %xmm1, %xmm0
pxor %xmm1, %xmm1
pcmpeqd %xmm1, %xmm0
movmskps %xmm0, %eax
xorl $0xf, %eax
sete %al
andb %r15b, %r14b
andb %al, %r14b
leaq 0xa52f(%rip), %rax      # 0x12f76
leaq 0xa577(%rip), %rsi      # 0x12fc5
cmovneq %rax, %rsi
leaq 0x7676(%rip), %rdx      # 0x100cf
leaq 0x7656(%rip), %rax      # 0x100b6
cmovneq %rax, %rdx
movl %ebx, %edi
xorl %eax, %eax
callq 0x3410
leaq 0xa5a0(%rip), %rsi      # 0x13014
movl %ebx, %edi
xorl %eax, %eax
callq 0x3410
leaq 0xa5dc(%rip), %rsi      # 0x13060
movl %ebx, %edi
xorl %eax, %eax
callq 0x3410
leaq 0x10(%rsp), %rbp
movq %rbp, %rdi
xorl %esi, %esi
callq 0xc2bf
testq %rax, %rax
setne 0x8(%rsp)
leaq 0xa5dd(%rip), %rsi      # 0x13088
movl %ebx, %edi
xorl %eax, %eax
callq 0x3410
movq %rbp, %rdi
xorl %esi, %esi
movl %r12d, %edx
callq 0xc438
movq %rax, 0x48(%rsp)
leaq 0xa5e1(%rip), %rsi      # 0x130ae
movl %ebx, %edi
xorl %eax, %eax
callq 0x3410
movq %rbp, %rdi
pushq $0x63
popq %r15
movl %r15d, %esi
xorl %edx, %edx
callq 0xc438
movq %rax, 0x38(%rsp)
leaq 0xa5e1(%rip), %rsi      # 0x130d4
movl %ebx, %edi
xorl %eax, %eax
callq 0x3410
movq %rbp, %rdi
xorl %esi, %esi
movl %r12d, %edx
pushq $-0x1
popq %r13
movl %r13d, %ecx
callq 0xc47a
movq %rax, 0x40(%rsp)
leaq 0xa5de(%rip), %rsi      # 0x130fa
movl %ebx, %edi
xorl %eax, %eax
callq 0x3410
movq %rbp, %rdi
movl %r15d, %esi
xorl %edx, %edx
movl %r13d, %ecx
callq 0xc47a
testq %rax, %rax
sete %r13b
leaq 0xa5dd(%rip), %rsi      # 0x13120
movl %ebx, %edi
xorl %eax, %eax
callq 0x3410
movq %rbp, %rdi
movl %r15d, %esi
movl %r12d, %edx
xorl %ecx, %ecx
callq 0xc47a
movq %rax, %r12
leaq 0xa5e2(%rip), %rsi      # 0x13148
movl %ebx, %edi
xorl %eax, %eax
callq 0x3410
movq %rbp, %rdi
xorl %esi, %esi
pushq $0x2a
popq %rdx
callq 0xc3c9
movq %rax, %r15
leaq 0xa5ea(%rip), %rsi      # 0x13170
movl %ebx, %edi
xorl %eax, %eax
callq 0x3410
movq %rbp, %rdi
leaq 0xa376(%rip), %rsi      # 0x12f0f
xorl %edx, %edx
callq 0xc3c9
movq %r15, %xmm0
movq %rax, %xmm1
punpcklqdq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0]
movq 0x48(%rsp), %xmm0
movq 0x38(%rsp), %xmm2
punpcklqdq %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0]
pxor %xmm0, %xmm0
pcmpeqd %xmm0, %xmm2
pcmpeqd %xmm0, %xmm1
movdqa %xmm1, %xmm0
shufps $0xdd, %xmm2, %xmm0     # xmm0 = xmm0[1,3],xmm2[1,3]
shufps $0x88, %xmm2, %xmm1     # xmm1 = xmm1[0,2],xmm2[0,2]
andps %xmm0, %xmm1
movmskps %xmm1, %eax
testl %eax, %eax
sete %al
orq 0x40(%rsp), %r12
sete %bpl
andb 0x8(%rsp), %bpl
andb %al, %bpl
andb %r14b, %bpl
andb %r13b, %bpl
leaq 0xa597(%rip), %rax      # 0x13196
leaq 0xa5e0(%rip), %rsi      # 0x131e6
cmovneq %rax, %rsi
leaq 0x74be(%rip), %rdx      # 0x100cf
leaq 0x749e(%rip), %rax      # 0x100b6
cmovneq %rax, %rdx
movl %ebx, %edi
xorl %eax, %eax
callq 0x3410
callq 0x94ae
andb %bpl, %al
movzbl %al, %edi
xorl %esi, %esi
callq 0x3ac9
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq