// File: /workspace/github_c_makefile_star2_O1/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
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
leaq 0xbbe0(%rip), %rsi      # 0x12c05
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
leaq 0xbc01(%rip), %rsi      # 0x12c39
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
xorps %xmm0, %xmm0
movq %rsp, %rdi
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
movq $0x0, 0x20(%rdi)
callq 0xeaa0
movl %eax, %ebp
andb %bl, %bpl
movzbl %bpl, %ebx
movl %ebx, %edi
movl %ebx, %esi
callq 0x3b04
cmpb $0x1, %bl
jne 0x714d
leaq 0xbbe7(%rip), %rsi      # 0x12c67
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
movq %rsp, %rbx
movq %rbx, %rdi
callq 0xeb24
movzbl %al, %ebp
movl %ebp, %edi
movl %ebp, %esi
callq 0x3b04
leaq 0xbbeb(%rip), %rsi      # 0x12c95
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
movq %rbx, %rdi
callq 0xebc2
andb %al, %bpl
movzbl %bpl, %ebp
movl %ebp, %edi
movl %ebp, %esi
callq 0x3b04
leaq 0xbbf2(%rip), %rsi      # 0x12cc7
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
movq %rbx, %rdi
callq 0xeb73
andb %al, %bpl
movzbl %bpl, %ebp
movl %ebp, %edi
movl %ebp, %esi
callq 0x3b04
leaq 0xbbfd(%rip), %rsi      # 0x12cfd
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
movq %rbx, %rdi
callq 0xebc2
andb %al, %bpl
movzbl %bpl, %ebp
movl %ebp, %edi
movl %ebp, %esi
callq 0x3b04
leaq 0xbbfb(%rip), %rsi      # 0x12d26
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
movq %rbx, %rdi
callq 0xec11
andb %al, %bpl
movzbl %bpl, %edi
movl %edi, %esi
callq 0x3b04
leaq 0xbbfc(%rip), %rax      # 0x12d50
leaq 0xbc36(%rip), %rsi      # 0x12d91
testb %bpl, %bpl
cmovneq %rax, %rsi
leaq 0x9f4d(%rip), %r13      # 0x110b6
leaq 0x9f5f(%rip), %rbx      # 0x110cf
movq %rbx, %rdx
cmovneq %r13, %rdx
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
leaq 0xbc48(%rip), %rsi      # 0x12dd2
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
leaq 0xbc5d(%rip), %rsi      # 0x12dfa
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
xorl %edi, %edi
callq 0xeaa0
movl %eax, %r14d
xorb $0x1, %r14b
andb %bpl, %r14b
leaq 0xbc71(%rip), %rsi      # 0x12e32
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
xorl %edi, %edi
callq 0xeb24
movl %eax, %r15d
leaq 0xbc8a(%rip), %rsi      # 0x12e68
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
xorl %edi, %edi
callq 0xeb73
movl %eax, %ebp
leaq 0xbca7(%rip), %rsi      # 0x12ea1
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
xorl %edi, %edi
callq 0xebc2
movl %eax, %r12d
leaq 0xbcc2(%rip), %rsi      # 0x12ed9
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
xorl %edi, %edi
callq 0xec11
orb %r12b, %al
orb %r15b, %bpl
orb %al, %bpl
xorb $0x1, %bpl
andb %r14b, %bpl
leaq 0xbcd1(%rip), %rax      # 0x12f12
leaq 0xbd04(%rip), %rsi      # 0x12f4c
testb $0x1, %bpl
cmovneq %rax, %rsi
cmovneq %r13, %rbx
movl $0x1, %edi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3400
callq 0x9a36
andb %bpl, %al
movzbl %al, %edi
xorl %esi, %esi
callq 0x3b04
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq