// File: /workspace/github_c_makefile_star2_O1/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 $0x168, %rsp            # imm = 0x168
movabsq $0x646f5a2065726f66, %r15 # imm = 0x646F5A2065726F66
movabsq $0x6562206c65656e4b, %r12 # imm = 0x6562206C65656E4B
leaq 0x60(%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)
movw $0x0, 0x8(%rbx)
movq %rbx, %rdi
callq 0x9a31
movl %eax, %ebx
movaps 0xc296(%rip), %xmm0     # 0x14e50
movq %rsp, %r14
movaps %xmm0, 0x10(%r14)
movdqa 0xc276(%rip), %xmm0     # 0x14e40
movdqa %xmm0, (%r14)
movb $0x0, 0x20(%r14)
leaq 0xb104(%rip), %rsi      # 0x13cdf
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
movq %r14, %rdi
callq 0xcc9f
movq %r12, %xmm2
movq %r15, %xmm3
testq %rax, %rax
je 0x8c30
movdqa %xmm2, %xmm0
punpcklqdq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0]
movzwl 0x10(%rsp), %eax
pcmpeqb (%rsp), %xmm0
movd %eax, %xmm1
pcmpeqb 0x8894(%rip), %xmm1     # 0x114b0
pand %xmm0, %xmm1
pmovmskb %xmm1, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
sete %bpl
andb %bl, %bpl
movdqa %xmm3, 0x30(%rsp)
movdqa %xmm2, 0x40(%rsp)
leaq 0xb0e8(%rip), %rsi      # 0x13d2b
xorl %r15d, %r15d
movq %rsp, %rbx
movl $0x1, %edi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3400
leaq 0xb19e(%rip), %rsi      # 0x13dfd
movq %rbx, %rdi
callq 0xcbf3
testq %rax, %rax
je 0x8ca2
movdqa 0x40(%rsp), %xmm0
punpcklqdq 0x30(%rsp), %xmm0 # xmm0 = xmm0[0],mem[0]
movzbl 0x10(%rsp), %eax
pcmpeqb (%rsp), %xmm0
movd %eax, %xmm1
pcmpeqb 0x8832(%rip), %xmm1     # 0x114c0
pand %xmm0, %xmm1
pmovmskb %xmm1, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
sete %r15b
andb %bpl, %r15b
leaq 0xb0b7(%rip), %rsi      # 0x13d60
xorl %r14d, %r14d
movq %rsp, %rbx
movl $0x1, %edi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3400
movq %rbx, %rdi
movl $0x3f, %esi
movl $0x2e, %edx
callq 0xcd84
testq %rax, %rax
je 0x8d0b
movdqa 0x40(%rsp), %xmm0
punpcklqdq 0x30(%rsp), %xmm0 # xmm0 = xmm0[0],mem[0]
movzbl 0x10(%rsp), %eax
pcmpeqb (%rsp), %xmm0
movd %eax, %xmm1
pcmpeqb 0x87d9(%rip), %xmm1     # 0x114d0
pand %xmm0, %xmm1
pmovmskb %xmm1, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
sete %r14b
andb %r15b, %r14b
leaq 0xb083(%rip), %rsi      # 0x13d95
xorl %ebp, %ebp
movq %rsp, %rbx
movl $0x1, %edi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3400
movq %rbx, %rdi
movl $0x2e, %esi
movl $0x21, %edx
movl $0x1, %ecx
callq 0xcdcb
cmpq $0x1, %rax
jne 0x8d79
movdqa 0x40(%rsp), %xmm1
punpcklqdq 0x30(%rsp), %xmm1 # xmm1 = xmm1[0],mem[0]
movzbl 0x10(%rsp), %eax
pcmpeqb (%rsp), %xmm1
movd %eax, %xmm0
pcmpeqb 0x877b(%rip), %xmm0     # 0x114e0
pand %xmm1, %xmm0
pmovmskb %xmm0, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
sete %bpl
andb %r14b, %bpl
movabsq $0x646f5a202a726f66, %r15 # imm = 0x646F5A202A726F66
movabsq $0x2a62206c2a2a6e4b, %r12 # imm = 0x2A62206C2A2A6E4B
leaq 0xb036(%rip), %rsi      # 0x13dca
xorl %r14d, %r14d
movq %rsp, %rbx
movl $0x1, %edi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3400
leaq 0xca8a(%rip), %rsi      # 0x1583a
movq %rbx, %rdi
movl $0x2a, %edx
callq 0xcd19
movq %r12, %xmm2
movq %r15, %xmm3
testq %rax, %rax
je 0x8dfe
movdqa %xmm2, %xmm0
punpcklqdq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0]
movzbl 0x10(%rsp), %eax
pcmpeqb (%rsp), %xmm0
movd %eax, %xmm1
pcmpeqb 0x86f6(%rip), %xmm1     # 0x114e0
pand %xmm0, %xmm1
pmovmskb %xmm1, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
sete %r14b
andb %bpl, %r14b
movdqa %xmm3, 0x30(%rsp)
movdqa %xmm2, 0x40(%rsp)
leaq 0xafee(%rip), %rsi      # 0x13dff
xorl %ebp, %ebp
movq %rsp, %rbx
movl $0x1, %edi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3400
leaq 0xaff6(%rip), %rsi      # 0x13e22
movq %rbx, %rdi
movl $0x59, %edx
callq 0xcd19
testq %rax, %rax
je 0x8e74
movdqa 0x40(%rsp), %xmm1
punpcklqdq 0x30(%rsp), %xmm1 # xmm1 = xmm1[0],mem[0]
movzbl 0x10(%rsp), %eax
pcmpeqb (%rsp), %xmm1
movd %eax, %xmm0
pcmpeqb 0x8680(%rip), %xmm0     # 0x114e0
pand %xmm1, %xmm0
pmovmskb %xmm0, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
sete %bpl
andb %r14b, %bpl
leaq 0xafa9(%rip), %rsi      # 0x13e24
movq %rsp, %rdx
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
leaq 0xafb6(%rip), %rax      # 0x13e47
leaq 0xafed(%rip), %rsi      # 0x13e85
testb %bpl, %bpl
cmovneq %rax, %rsi
leaq 0x8210(%rip), %rax      # 0x110b6
leaq 0x8222(%rip), %rcx      # 0x110cf
movq %rcx, %rdx
movq %rcx, %rbx
cmovneq %rax, %rdx
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
leaq 0xaff9(%rip), %rsi      # 0x13ec3
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
leaq 0xb030(%rip), %rsi      # 0x13f0d
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
xorl %edi, %edi
callq 0xcc9f
movq %rax, %r12
leaq 0xb034(%rip), %rsi      # 0x13f2e
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
leaq 0xb042(%rip), %rsi      # 0x13f4f
xorl %edi, %edi
callq 0xcbf3
movq %rax, %r13
leaq 0xb035(%rip), %rsi      # 0x13f53
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
xorl %edi, %edi
movl $0x63, %esi
movl $0x6e, %edx
callq 0xcd84
movq %rax, %r15
leaq 0xb02f(%rip), %rsi      # 0x13f74
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
xorl %edi, %edi
movl $0x63, %esi
movl $0x6e, %edx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0xcdcb
testq %rax, %rax
sete %r14b
leaq 0xb020(%rip), %rsi      # 0x13f95
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
leaq 0x82a1(%rip), %rsi      # 0x11229
xorl %edi, %edi
movl $0x2a, %edx
callq 0xcd19
movq %r15, %xmm0
movq %rax, %xmm1
punpcklqdq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0]
movq %r13, %xmm0
movq %r12, %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 %bpl, %r14b
andb %al, %r14b
leaq 0xafe4(%rip), %rax      # 0x13fb6
leaq 0xb02c(%rip), %rsi      # 0x14005
cmovneq %rax, %rsi
movq %rbx, %rdx
leaq 0x80cf(%rip), %rax      # 0x110b6
cmovneq %rax, %rdx
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
leaq 0xb056(%rip), %rsi      # 0x14054
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
leaq 0xb08f(%rip), %rsi      # 0x140a0
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
movq %rsp, %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xcbf3
testq %rax, %rax
setne 0x40(%rsp)
leaq 0xb08f(%rip), %rsi      # 0x140c8
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
movq %rbx, %rdi
xorl %esi, %esi
movl $0x6e, %edx
callq 0xcd84
movq %rax, 0x30(%rsp)
leaq 0xb08e(%rip), %rsi      # 0x140ee
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
movq %rbx, %rdi
movl $0x63, %esi
xorl %edx, %edx
callq 0xcd84
movq %rax, %rbp
leaq 0xb08f(%rip), %rsi      # 0x14114
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
movq %rbx, %rdi
xorl %esi, %esi
movl $0x6e, %edx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0xcdcb
movq %rax, 0x58(%rsp)
leaq 0xb089(%rip), %rsi      # 0x1413a
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
movq %rbx, %rdi
movl $0x63, %esi
xorl %edx, %edx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0xcdcb
testq %rax, %rax
sete %r13b
leaq 0xb081(%rip), %rsi      # 0x14160
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
movq %rbx, %rdi
movl $0x63, %esi
movl $0x6e, %edx
xorl %ecx, %ecx
callq 0xcdcb
movq %rax, %r15
leaq 0xb07f(%rip), %rsi      # 0x14188
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
movq %rbx, %rdi
xorl %esi, %esi
movl $0x2a, %edx
callq 0xcd19
movq %rax, %r12
leaq 0xb082(%rip), %rsi      # 0x141b0
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
movq %rbx, %rdi
leaq 0xae0b(%rip), %rsi      # 0x13f4f
xorl %edx, %edx
callq 0xcd19
movq %r12, %xmm0
movq %rax, %xmm1
punpcklqdq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0]
movq 0x30(%rsp), %xmm0
movq %rbp, %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 0x58(%rsp), %r15
sete %bpl
andb 0x40(%rsp), %bpl
andb %al, %bpl
andb %r14b, %bpl
andb %r13b, %bpl
leaq 0xb02d(%rip), %rax      # 0x141d6
leaq 0xb076(%rip), %rsi      # 0x14226
cmovneq %rax, %rsi
leaq 0x7efb(%rip), %rax      # 0x110b6
leaq 0x7f0d(%rip), %rdx      # 0x110cf
cmovneq %rax, %rdx
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
callq 0x9a36
andb %bpl, %al
movzbl %al, %edi
xorl %esi, %esi
callq 0x3b04
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq