// File: /workspace/github_c_makefile_star2_O3/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)
movq %rbx, %rdi
callq 0x9a21
movl %eax, %ebx
movaps 0xc2b6(%rip), %xmm0     # 0x14e50
movq %rsp, %r14
movaps %xmm0, 0x10(%r14)
movdqa 0xc296(%rip), %xmm0     # 0x14e40
movdqa %xmm0, (%r14)
movb $0x0, 0x20(%r14)
leaq 0xb124(%rip), %rsi      # 0x13cdf
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
movq %r14, %rdi
callq 0xcba1
movq %r12, %xmm2
movq %r15, %xmm3
testq %rax, %rax
je 0x8c10
movdqa %xmm2, %xmm0
punpcklqdq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0]
movzwl 0x10(%rsp), %eax
pcmpeqb (%rsp), %xmm0
movd %eax, %xmm1
pcmpeqb 0x88b4(%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 0xb108(%rip), %rsi      # 0x13d2b
xorl %r15d, %r15d
movq %rsp, %rbx
movl $0x1, %edi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3400
leaq 0xb1be(%rip), %rsi      # 0x13dfd
movq %rbx, %rdi
callq 0xcaf4
testq %rax, %rax
je 0x8c82
movdqa 0x40(%rsp), %xmm0
punpcklqdq 0x30(%rsp), %xmm0 # xmm0 = xmm0[0],mem[0]
movzbl 0x10(%rsp), %eax
pcmpeqb (%rsp), %xmm0
movd %eax, %xmm1
pcmpeqb 0x8852(%rip), %xmm1     # 0x114c0
pand %xmm0, %xmm1
pmovmskb %xmm1, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
sete %r15b
andb %bpl, %r15b
leaq 0xb0d7(%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 0xcc86
testq %rax, %rax
je 0x8ceb
movdqa 0x40(%rsp), %xmm0
punpcklqdq 0x30(%rsp), %xmm0 # xmm0 = xmm0[0],mem[0]
movzbl 0x10(%rsp), %eax
pcmpeqb (%rsp), %xmm0
movd %eax, %xmm1
pcmpeqb 0x87f9(%rip), %xmm1     # 0x114d0
pand %xmm0, %xmm1
pmovmskb %xmm1, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
sete %r14b
andb %r15b, %r14b
leaq 0xb0a3(%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 0xccc8
cmpq $0x1, %rax
jne 0x8d59
movdqa 0x40(%rsp), %xmm1
punpcklqdq 0x30(%rsp), %xmm1 # xmm1 = xmm1[0],mem[0]
movzbl 0x10(%rsp), %eax
pcmpeqb (%rsp), %xmm1
movd %eax, %xmm0
pcmpeqb 0x879b(%rip), %xmm0     # 0x114e0
pand %xmm1, %xmm0
pmovmskb %xmm0, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
sete %bpl
andb %r14b, %bpl
movabsq $0x646f5a202a726f66, %r14 # imm = 0x646F5A202A726F66
movabsq $0x2a62206c2a2a6e4b, %r15 # imm = 0x2A62206C2A2A6E4B
leaq 0xb056(%rip), %rsi      # 0x13dca
xorl %r12d, %r12d
movq %rsp, %rbx
movl $0x1, %edi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3400
leaq 0xca9a(%rip), %rsi      # 0x1582a
movq %rbx, %rdi
movl $0x2a, %edx
callq 0xcc06
testq %rax, %rax
je 0x8dda
movq %r15, %xmm0
movq %r14, %xmm1
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movzbl 0x10(%rsp), %eax
pcmpeqb (%rsp), %xmm0
movd %eax, %xmm1
pcmpeqb 0x871a(%rip), %xmm1     # 0x114e0
pand %xmm0, %xmm1
pmovmskb %xmm1, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
sete %r12b
andb %bpl, %r12b
leaq 0xb01e(%rip), %rsi      # 0x13dff
movq %rsp, %rbx
movl $0x1, %edi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3400
leaq 0xb028(%rip), %rsi      # 0x13e22
movq %rbx, %rdi
movl $0x59, %edx
callq 0xcc06
testq %rax, %rax
je 0x8e67
movq %rsp, %rdx
xorq 0x8(%rdx), %r14
xorq (%rdx), %r15
movzbl 0x10(%rdx), %eax
xorq $0x21, %rax
orq %r15, %rax
orq %r14, %rax
sete %bpl
andb %r12b, %bpl
leaq 0xaff2(%rip), %rsi      # 0x13e24
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
leaq 0xb002(%rip), %rax      # 0x13e47
leaq 0xb039(%rip), %rsi      # 0x13e85
testb %bpl, %bpl
cmovneq %rax, %rsi
leaq 0x825c(%rip), %rax      # 0x110b6
leaq 0x826e(%rip), %rdx      # 0x110cf
cmovneq %rax, %rdx
jmp 0x8e8d
leaq 0xafb6(%rip), %rsi      # 0x13e24
xorl %ebp, %ebp
movq %rsp, %rdx
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
leaq 0x8249(%rip), %rdx      # 0x110cf
leaq 0xaff8(%rip), %rsi      # 0x13e85
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
leaq 0xb023(%rip), %rsi      # 0x13ec3
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
leaq 0xb05a(%rip), %rsi      # 0x13f0d
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
xorl %edi, %edi
callq 0xcba1
movq %rax, %r14
leaq 0xb05e(%rip), %rsi      # 0x13f2e
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
leaq 0xb06c(%rip), %rsi      # 0x13f4f
xorl %edi, %edi
callq 0xcaf4
movq %rax, %r15
leaq 0xb05f(%rip), %rsi      # 0x13f53
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
xorl %edi, %edi
movl $0x63, %esi
movl $0x6e, %edx
callq 0xcc86
movq %rax, %rbx
leaq 0xb059(%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 0xccc8
testq %rax, %rax
sete %r13b
leaq 0xb04a(%rip), %rsi      # 0x13f95
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
leaq 0x82cb(%rip), %rsi      # 0x11229
xorl %edi, %edi
movl $0x2a, %edx
callq 0xcc06
movq %rbx, %xmm0
movq %rax, %xmm1
punpcklqdq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0]
movq %r15, %xmm0
movq %r14, %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, %r13b
andb %al, %r13b
leaq 0xb00e(%rip), %rax      # 0x13fb6
leaq 0xb056(%rip), %rsi      # 0x14005
cmovneq %rax, %rsi
leaq 0x80fc(%rip), %rax      # 0x110b6
leaq 0x810e(%rip), %r14      # 0x110cf
movq %r14, %rdx
cmovneq %rax, %rdx
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
leaq 0xb079(%rip), %rsi      # 0x14054
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
leaq 0xb0b2(%rip), %rsi      # 0x140a0
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
movq %rsp, %r15
movq %r15, %rdi
xorl %esi, %esi
callq 0xcaf4
testq %rax, %rax
setne 0x40(%rsp)
leaq 0xb0b2(%rip), %rsi      # 0x140c8
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
movq %r15, %rdi
xorl %esi, %esi
movl $0x6e, %edx
callq 0xcc86
movq %rax, 0x30(%rsp)
leaq 0xb0b1(%rip), %rsi      # 0x140ee
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
movq %r15, %rdi
movl $0x63, %esi
xorl %edx, %edx
callq 0xcc86
movq %rax, 0x50(%rsp)
leaq 0xb0b0(%rip), %rsi      # 0x14114
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
movq %r15, %rdi
xorl %esi, %esi
movl $0x6e, %edx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0xccc8
movq %rax, 0x58(%rsp)
leaq 0xb0aa(%rip), %rsi      # 0x1413a
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
movq %r15, %rdi
movl $0x63, %esi
xorl %edx, %edx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0xccc8
testq %rax, %rax
sete %bpl
leaq 0xb0a2(%rip), %rsi      # 0x14160
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
movq %r15, %rdi
movl $0x63, %esi
movl $0x6e, %edx
xorl %ecx, %ecx
callq 0xccc8
movq %rax, %rbx
leaq 0xb0a0(%rip), %rsi      # 0x14188
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
movq %r15, %rdi
xorl %esi, %esi
movl $0x2a, %edx
callq 0xcc06
movq %rax, %r12
leaq 0xb0a3(%rip), %rsi      # 0x141b0
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
movq %r15, %rdi
leaq 0xae2c(%rip), %rsi      # 0x13f4f
xorl %edx, %edx
callq 0xcc06
movq %r12, %xmm0
movq %rax, %xmm1
punpcklqdq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0]
movq 0x30(%rsp), %xmm0
movq 0x50(%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 0x58(%rsp), %rbx
sete %bl
andb 0x40(%rsp), %bl
andb %al, %bl
andb %r13b, %bl
andb %bpl, %bl
leaq 0xb050(%rip), %rax      # 0x141d6
leaq 0xb099(%rip), %rsi      # 0x14226
cmovneq %rax, %rsi
leaq 0x7f1e(%rip), %rax      # 0x110b6
cmovneq %rax, %r14
movl $0x1, %edi
movq %r14, %rdx
xorl %eax, %eax
callq 0x3400
callq 0x9a26
andb %bl, %al
movzbl %al, %edi
xorl %esi, %esi
callq 0x3b6d
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq