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

    TEST_MSG_0(SIR_WHITEB("create, lock, unlock, destroy"));
    (void)printf(INDENT_ITEM SIR_WHITE("creating mutex...") SIR_EOL);

#if !defined(__IMPORTC__)
    sir_mutex m1 = SIR_MUTEX_INIT;
#else
    sir_mutex m1 = {0};
#endif
    _sir_eqland(pass, _sir_mutexcreate(&m1));

    (void)print_test_error(pass, pass);

    if (pass) {
        (void)printf(INDENT_ITEM SIR_WHITE("locking (wait)...") SIR_EOL);
        _sir_eqland(pass, _sir_mutexlock(&m1));

        (void)print_test_error(pass, pass);

        (void)printf(INDENT_ITEM SIR_WHITE("entered; unlocking...") SIR_EOL);
        _sir_eqland(pass, _sir_mutexunlock(&m1));

        (void)print_test_error(pass, pass);

        (void)printf(INDENT_ITEM SIR_WHITE("locking (without wait)...") SIR_EOL);
        _sir_eqland(pass, _sir_mutextrylock(&m1));

        (void)print_test_error(pass, pass);

        (void)printf(INDENT_ITEM SIR_WHITE("unlocking...") SIR_EOL);
        _sir_eqland(pass, _sir_mutexunlock(&m1));

        (void)print_test_error(pass, pass);

        (void)printf(INDENT_ITEM SIR_WHITE("destroying...") SIR_EOL);
        _sir_eqland(pass, _sir_mutexdestroy(&m1));

        (void)print_test_error(pass, pass);

    }
    PASSFAIL_MSG(pass, "\t--- create, lock, unlock, destroy: %s ---" SIR_EOL SIR_EOL, PRN_PASS(pass));

    TEST_MSG_0(SIR_WHITEB("invalid arguments"));
    (void)printf(INDENT_ITEM SIR_WHITE("create with NULL pointer...") SIR_EOL);
    _sir_eqland(pass, !_sir_mutexcreate(NULL));
    (void)printf(INDENT_ITEM SIR_WHITE("lock with NULL pointer...") SIR_EOL);
    _sir_eqland(pass, !_sir_mutexlock(NULL));
    (void)printf(INDENT_ITEM SIR_WHITE("trylock with NULL pointer...") SIR_EOL);
    _sir_eqland(pass, !_sir_mutextrylock(NULL));
    (void)printf(INDENT_ITEM SIR_WHITE("unlock with NULL pointer...") SIR_EOL);
    _sir_eqland(pass, !_sir_mutexunlock(NULL));
    (void)printf(INDENT_ITEM SIR_WHITE("destroy with NULL pointer...") SIR_EOL);
    _sir_eqland(pass, !_sir_mutexdestroy(NULL));
    PASSFAIL_MSG(pass, "\t--- pass invalid arguments: %s ---" SIR_EOL SIR_EOL, PRN_PASS(pass));

    _sir_eqland(pass, sir_cleanup());
    return PRINT_RESULT_RETURN(pass); //-V1020
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
leaq 0x30(%rsp), %rbx
xorl %r15d, %r15d
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
leaq 0xaddb(%rip), %rsi      # 0x11bc5
pushq $0x1
popq %rbp
movl %ebp, %edi
xorl %eax, %eax
callq 0x3410
leaq 0xadfc(%rip), %rsi      # 0x11bf9
movl %ebp, %edi
xorl %eax, %eax
callq 0x3410
xorps %xmm0, %xmm0
movq %rsp, %rdi
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
andq $0x0, 0x20(%rdi)
callq 0xdf34
andb %bl, %al
movzbl %al, %ebp
movl %ebp, %edi
movl %ebp, %esi
callq 0x3ac9
leaq 0x929d(%rip), %rbx      # 0x100cf
leaq 0xaf18(%rip), %r14      # 0x11d51
cmpb $0x1, %bpl
jne 0x6f31
leaq 0xaddd(%rip), %rsi      # 0x11c27
pushq $0x1
popq %rbp
movl %ebp, %edi
xorl %eax, %eax
callq 0x3410
movq %rsp, %r15
movq %r15, %rdi
callq 0xdfc7
movzbl %al, %r12d
movl %r12d, %edi
movl %r12d, %esi
callq 0x3ac9
leaq 0xadde(%rip), %rsi      # 0x11c55
movl %ebp, %edi
xorl %eax, %eax
callq 0x3410
movq %r15, %rdi
callq 0xe04f
andb %al, %r12b
movzbl %r12b, %r12d
movl %r12d, %edi
movl %r12d, %esi
callq 0x3ac9
leaq 0xade6(%rip), %rsi      # 0x11c87
movl %ebp, %edi
xorl %eax, %eax
callq 0x3410
movq %r15, %rdi
callq 0xe00b
andb %al, %r12b
movzbl %r12b, %r12d
movl %r12d, %edi
movl %r12d, %esi
callq 0x3ac9
leaq 0xadf2(%rip), %rsi      # 0x11cbd
movl %ebp, %edi
xorl %eax, %eax
callq 0x3410
movq %r15, %rdi
callq 0xe04f
andb %al, %r12b
movzbl %r12b, %r12d
movl %r12d, %edi
movl %r12d, %esi
callq 0x3ac9
leaq 0xadf1(%rip), %rsi      # 0x11ce6
movl %ebp, %edi
xorl %eax, %eax
callq 0x3410
movq %r15, %rdi
callq 0xe093
andb %al, %r12b
movzbl %r12b, %ebp
movl %ebp, %edi
movl %ebp, %esi
callq 0x3ac9
testb %bpl, %bpl
je 0x6f2e
leaq 0x9194(%rip), %rdx      # 0x100b6
movb $0x1, %r15b
leaq 0xade4(%rip), %r14      # 0x11d10
jmp 0x6f34
xorl %r15d, %r15d
movq %rbx, %rdx
pushq $0x1
popq %rbp
movl %ebp, %edi
movq %r14, %rsi
xorl %eax, %eax
callq 0x3410
leaq 0xae48(%rip), %rsi      # 0x11d92
movl %ebp, %edi
xorl %eax, %eax
callq 0x3410
leaq 0xae60(%rip), %rsi      # 0x11dba
movl %ebp, %edi
xorl %eax, %eax
callq 0x3410
xorl %edi, %edi
callq 0xdf34
movl %eax, %r14d
xorb $0x1, %r14b
andb %r15b, %r14b
leaq 0xae77(%rip), %rsi      # 0x11df2
movl %ebp, %edi
xorl %eax, %eax
callq 0x3410
xorl %edi, %edi
callq 0xdfc7
movl %eax, %r12d
leaq 0xae93(%rip), %rsi      # 0x11e28
movl %ebp, %edi
xorl %eax, %eax
callq 0x3410
xorl %edi, %edi
callq 0xe00b
movl %eax, %r15d
leaq 0xaeb2(%rip), %rsi      # 0x11e61
movl %ebp, %edi
xorl %eax, %eax
callq 0x3410
xorl %edi, %edi
callq 0xe04f
movl %eax, %r13d
leaq 0xaed0(%rip), %rsi      # 0x11e99
movl %ebp, %edi
xorl %eax, %eax
callq 0x3410
xorl %edi, %edi
callq 0xe093
orb %r13b, %al
orb %r12b, %r15b
orb %al, %r15b
xorb $0x1, %r15b
andb %r14b, %r15b
leaq 0xaee2(%rip), %rax      # 0x11ed2
leaq 0xaf15(%rip), %rsi      # 0x11f0c
testb $0x1, %r15b
cmovneq %rax, %rsi
leaq 0x90b0(%rip), %rax      # 0x100b6
cmovneq %rax, %rbx
movl %ebp, %edi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3410
callq 0x94ae
andb %r15b, %al
movzbl %al, %edi
xorl %esi, %esi
callq 0x3ac9
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq