// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/tests/tests.c
// Function: sirtest_updatesanity
bool sirtest_updatesanity(void) {
    INIT_N(si, SIRL_DEFAULT, 0, SIRL_DEFAULT, 0, "update_sanity");
    bool pass = si_init;

#define UPDATE_SANITY_ARRSIZE 10

    static const char* logfile = MAKE_LOG_NAME("update-sanity.log");
    static const sir_options opts_array[UPDATE_SANITY_ARRSIZE] = {
        SIRO_NOHOST | SIRO_NOTIME | SIRO_NOLEVEL,
        SIRO_MSGONLY,
        SIRO_NONAME | SIRO_NOTID,
        SIRO_NOPID | SIRO_NOTIME,
        SIRO_NOTIME | SIRO_NOLEVEL | SIRO_NONAME,
        SIRO_NOTIME,
        SIRO_NOMSEC | SIRO_NOHOST,
        SIRO_NOPID | SIRO_NOTID,
        SIRO_NOHOST | SIRO_NOTID,
        SIRO_ALL
    };

    static const sir_levels levels_array[UPDATE_SANITY_ARRSIZE] = {
        SIRL_NONE,
        SIRL_ALL,
        SIRL_EMERG,
        SIRL_ALERT,
        SIRL_CRIT,
        SIRL_ERROR,
        SIRL_WARN,
        SIRL_NOTICE,
        SIRL_INFO,
        SIRL_DEBUG
    };

    rmfile(logfile, cl_cfg.leave_logs);
    sirfileid id1 = sir_addfile(logfile, SIRL_DEFAULT, SIRO_DEFAULT);
    _sir_eqland(pass, 0 != id1);

    for (int i = 0; i < 10; i++) {
        if (!pass)
            break;

        /* reset to defaults*/
        _sir_eqland(pass, sir_stdoutlevels(SIRL_DEFAULT));
        _sir_eqland(pass, sir_stderrlevels(SIRL_DEFAULT));
        _sir_eqland(pass, sir_stdoutopts(SIRO_DEFAULT));
        _sir_eqland(pass, sir_stderropts(SIRO_DEFAULT));

        _sir_eqland(pass, sir_debug("default config (debug)"));
        _sir_eqland(pass, sir_info("default config (info)"));
        _sir_eqland(pass, sir_notice("default config (notice)"));
        _sir_eqland(pass, sir_warn("default config (warning)"));
        _sir_eqland(pass, sir_error("default config (error)"));
        _sir_eqland(pass, sir_crit("default config (critical)"));
        _sir_eqland(pass, sir_alert("default config (alert)"));
        _sir_eqland(pass, sir_emerg("default config (emergency)"));

        /* pick random options to set/unset */
        uint32_t rnd = getrand(UPDATE_SANITY_ARRSIZE);
        _sir_eqland(pass, sir_stdoutlevels(levels_array[rnd]));
        _sir_eqland(pass, sir_stdoutopts(opts_array[rnd]));
        TEST_MSG(SIR_WHITE("set random config #%"PRIu32" for stdout"), rnd);

        rnd = getrand(UPDATE_SANITY_ARRSIZE);
        _sir_eqland(pass, sir_stderrlevels(levels_array[rnd]));
        _sir_eqland(pass, sir_stderropts(opts_array[rnd]));
        TEST_MSG(SIR_WHITE("set random config #%"PRIu32" for stderr"), rnd);

        rnd = getrand(UPDATE_SANITY_ARRSIZE);
        _sir_eqland(pass, sir_filelevels(id1, levels_array[rnd]));
        _sir_eqland(pass, sir_fileopts(id1, opts_array[rnd]));
        TEST_MSG(SIR_WHITE("set random config #%"PRIu32" for %s"), rnd, logfile);

        _sir_eqland(pass, filter_error(sir_debug("modified config #%"PRIu32" (debug)", rnd), SIR_E_NODEST));
        _sir_eqland(pass, filter_error(sir_info("modified config #%"PRIu32" (info)", rnd), SIR_E_NODEST));
        _sir_eqland(pass, filter_error(sir_notice("modified config #%"PRIu32" (notice)", rnd), SIR_E_NODEST));
        _sir_eqland(pass, filter_error(sir_warn("modified config #%"PRIu32" (warning)", rnd), SIR_E_NODEST));
        _sir_eqland(pass, filter_error(sir_error("modified config #%"PRIu32" (error)", rnd), SIR_E_NODEST));
        _sir_eqland(pass, filter_error(sir_crit("modified config #%"PRIu32" (critical)", rnd), SIR_E_NODEST));
        _sir_eqland(pass, filter_error(sir_alert("modified config #%"PRIu32" (alert)", rnd), SIR_E_NODEST));
        _sir_eqland(pass, filter_error(sir_emerg("modified config #%"PRIu32" (emergency)", rnd), SIR_E_NODEST));
    }

    if (pass) {
        /* restore to default config and run again */
        _sir_eqland(pass, sir_stdoutlevels(SIRL_DEFAULT));
        _sir_eqland(pass, sir_stderrlevels(SIRL_DEFAULT));
        _sir_eqland(pass, sir_stdoutopts(SIRO_DEFAULT));
        _sir_eqland(pass, sir_stderropts(SIRO_DEFAULT));

        _sir_eqland(pass, sir_debug("default config (debug)"));
        _sir_eqland(pass, sir_info("default config (info)"));
        _sir_eqland(pass, sir_notice("default config (notice)"));
        _sir_eqland(pass, sir_warn("default config (warning)"));
        _sir_eqland(pass, sir_error("default config (error)"));
        _sir_eqland(pass, sir_crit("default config (critical)"));
        _sir_eqland(pass, sir_alert("default config (alert)"));
        _sir_eqland(pass, sir_emerg("default config (emergency)"));
    }

    _sir_eqland(pass, sir_remfile(id1));
    rmfile(logfile, cl_cfg.leave_logs);

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
leaq 0x20(%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 $0x100, %cx             # imm = 0x100
movw %cx, (%rbx)
movl %eax, 0xc(%rbx)
movw %cx, 0x8(%rbx)
leaq 0x108(%rsp), %rdi
leaq 0xadd0(%rip), %rdx      # 0x121d7
pushq $0x20
popq %rcx
movq %rcx, %rsi
callq 0xc015
movq %rbx, %rdi
callq 0x94a9
movl %eax, %ebx
movzbl 0x144e5(%rip), %esi     # 0x1b908
leaq 0xadbb(%rip), %r14      # 0x121e5
movq %r14, %rdi
callq 0x3fbf
movq %r14, %rdi
movl $0x100, %esi            # imm = 0x100
movl $0x100000, %edx         # imm = 0x100000
callq 0x9a6b
movl %eax, 0x1c(%rsp)
testl %eax, %eax
setne %r15b
andb %bl, %r15b
pushq $0xa
popq %rax
subl $0x1, %eax
jb 0x7779
testb $0x1, %r15b
je 0x7868
movl $0x100, %edi            # imm = 0x100
movl %eax, 0x18(%rsp)
callq 0x9b3b
movb %al, 0x6(%rsp)
movl $0x100, %edi            # imm = 0x100
callq 0x9bc6
movb %al, 0x5(%rsp)
movl $0x100000, %edi         # imm = 0x100000
callq 0x9b81
movb %al, 0x4(%rsp)
movl $0x100000, %edi         # imm = 0x100000
callq 0x9c0a
movb %al, 0x3(%rsp)
leaq 0xad54(%rip), %rdi      # 0x121fe
xorl %eax, %eax
callq 0x94cd
movb %al, 0x17(%rsp)
leaq 0xad59(%rip), %rdi      # 0x12215
xorl %eax, %eax
callq 0x95a2
movb %al, 0x16(%rsp)
leaq 0xad5d(%rip), %rdi      # 0x1222b
xorl %eax, %eax
callq 0x9651
movb %al, 0x15(%rsp)
leaq 0xad63(%rip), %rdi      # 0x12243
xorl %eax, %eax
callq 0x9700
movb %al, 0x14(%rsp)
leaq 0xad6a(%rip), %rdi      # 0x1225c
xorl %eax, %eax
callq 0x97af
movb %al, 0x13(%rsp)
leaq 0xad6f(%rip), %rdi      # 0x12273
xorl %eax, %eax
callq 0x985e
movb %al, 0x12(%rsp)
leaq 0xad77(%rip), %rdi      # 0x1228d
xorl %eax, %eax
callq 0x990d
movb %al, 0x11(%rsp)
leaq 0xad7c(%rip), %rdi      # 0x122a4
xorl %eax, %eax
callq 0x99bc
movl %eax, %r15d
pushq $0xa
popq %rdi
callq 0x3fab
movl %eax, %ebx
movl %eax, %r14d
leaq 0xc89a(%rip), %r13      # 0x13de0
movzwl (%r13,%r14,2), %edi
callq 0x9b3b
movb %al, 0x10(%rsp)
leaq 0xc854(%rip), %r12      # 0x13db0
movl (%r12,%r14,4), %edi
callq 0x9b81
movb %al, 0xf(%rsp)
pushq $0x1
popq %rbp
movl %ebp, %edi
leaq 0xad4a(%rip), %rsi      # 0x122bf
movl %ebx, %edx
xorl %eax, %eax
callq 0x3410
pushq $0xa
popq %rdi
callq 0x3fab
movl %eax, %ebx
movl %eax, %r14d
movzwl (%r13,%r14,2), %edi
callq 0x9bc6
movb %al, 0xe(%rsp)
movl (%r12,%r14,4), %edi
callq 0x9c0a
movb %al, 0xd(%rsp)
movl %ebp, %edi
leaq 0xad46(%rip), %rsi      # 0x122f6
movl %ebx, %edx
xorl %eax, %eax
callq 0x3410
pushq $0xa
popq %rdi
callq 0x3fab
movl %eax, %ebp
movl %eax, %ebx
movzwl (%r13,%rbx,2), %esi
movl 0x1c(%rsp), %r14d
movl %r14d, %edi
callq 0x9a7f
movb %al, 0xc(%rsp)
movl (%r12,%rbx,4), %esi
movl %r14d, %edi
callq 0x9abe
movb %al, 0xb(%rsp)
pushq $0x1
popq %rdi
leaq 0xad37(%rip), %rsi      # 0x1232d
movl %ebp, %edx
leaq 0xabe6(%rip), %rcx      # 0x121e5
xorl %eax, %eax
callq 0x3410
leaq 0xad53(%rip), %rdi      # 0x12360
movl %ebp, %esi
xorl %eax, %eax
callq 0x94cd
movzbl %al, %edi
pushq $0xd
popq %r12
movl %r12d, %esi
callq 0x78ae
movb %al, 0xa(%rsp)
leaq 0xad4c(%rip), %rdi      # 0x1237c
movl %ebp, %esi
xorl %eax, %eax
callq 0x95a2
movzbl %al, %edi
movl %r12d, %esi
callq 0x78ae
movb %al, 0x9(%rsp)
leaq 0xad48(%rip), %rdi      # 0x12397
movl %ebp, %esi
xorl %eax, %eax
callq 0x9651
movzbl %al, %edi
movl %r12d, %esi
callq 0x78ae
movb %al, 0x8(%rsp)
leaq 0xad46(%rip), %rdi      # 0x123b4
movl %ebp, %esi
xorl %eax, %eax
callq 0x9700
movzbl %al, %edi
movl %r12d, %esi
callq 0x78ae
movl %eax, %r14d
leaq 0xad46(%rip), %rdi      # 0x123d2
movl %ebp, %esi
xorl %eax, %eax
callq 0x97af
movzbl %al, %edi
movl %r12d, %esi
callq 0x78ae
movb %al, 0x7(%rsp)
leaq 0xad43(%rip), %rdi      # 0x123ee
movl %ebp, %esi
xorl %eax, %eax
callq 0x985e
movzbl %al, %edi
movl %r12d, %esi
callq 0x78ae
movl %eax, %r13d
leaq 0xad44(%rip), %rdi      # 0x1240d
movl %ebp, %esi
xorl %eax, %eax
callq 0x990d
movzbl %al, %edi
movl %r12d, %esi
callq 0x78ae
movl %eax, %ebx
leaq 0xad43(%rip), %rdi      # 0x12429
movl %ebp, %esi
xorl %eax, %eax
callq 0x99bc
movzbl %al, %edi
movl %r12d, %esi
callq 0x78ae
andb %bl, %al
andb 0x7(%rsp), %r13b
andb %al, %r13b
movl 0x18(%rsp), %eax
andb 0x8(%rsp), %r14b
andb 0x9(%rsp), %r14b
andb %r13b, %r14b
andb 0xa(%rsp), %r14b
andb 0xb(%rsp), %r14b
movb 0xc(%rsp), %cl
andb 0xd(%rsp), %cl
andb %r14b, %cl
movl %ecx, %edx
movb 0xe(%rsp), %cl
andb 0xf(%rsp), %cl
andb 0x10(%rsp), %cl
andb %dl, %cl
andb 0x11(%rsp), %r15b
andb 0x12(%rsp), %r15b
andb 0x13(%rsp), %r15b
andb 0x14(%rsp), %r15b
andb 0x15(%rsp), %r15b
andb 0x16(%rsp), %r15b
andb 0x17(%rsp), %r15b
andb 0x3(%rsp), %r15b
andb 0x4(%rsp), %r15b
andb 0x5(%rsp), %r15b
andb %cl, %r15b
andb 0x6(%rsp), %r15b
jmp 0x7454
testb $0x1, %r15b
je 0x7868
movl $0x100, %edi            # imm = 0x100
callq 0x9b3b
movb %al, 0x18(%rsp)
movl $0x100, %edi            # imm = 0x100
callq 0x9bc6
movb %al, 0x6(%rsp)
movl $0x100000, %edi         # imm = 0x100000
callq 0x9b81
movb %al, 0x5(%rsp)
movl $0x100000, %edi         # imm = 0x100000
callq 0x9c0a
movb %al, 0x4(%rsp)
leaq 0xaa3c(%rip), %rdi      # 0x121fe
xorl %eax, %eax
callq 0x94cd
movl %eax, %ebx
leaq 0xaa43(%rip), %rdi      # 0x12215
xorl %eax, %eax
callq 0x95a2
movb %al, 0x3(%rsp)
leaq 0xaa47(%rip), %rdi      # 0x1222b
xorl %eax, %eax
callq 0x9651
movl %eax, %r14d
leaq 0xaa4e(%rip), %rdi      # 0x12243
xorl %eax, %eax
callq 0x9700
movl %eax, %ebp
leaq 0xaa57(%rip), %rdi      # 0x1225c
xorl %eax, %eax
callq 0x97af
movl %eax, %r15d
leaq 0xaa5d(%rip), %rdi      # 0x12273
xorl %eax, %eax
callq 0x985e
movl %eax, %r12d
leaq 0xaa66(%rip), %rdi      # 0x1228d
xorl %eax, %eax
callq 0x990d
movl %eax, %r13d
leaq 0xaa6c(%rip), %rdi      # 0x122a4
xorl %eax, %eax
callq 0x99bc
andb %r13b, %al
andb %r15b, %r12b
andb %al, %r12b
andb %r14b, %bpl
andb 0x3(%rsp), %bpl
andb %r12b, %bpl
andb 0x4(%rsp), %bl
andb 0x5(%rsp), %bl
andb 0x6(%rsp), %bl
andb %bpl, %bl
andb 0x18(%rsp), %bl
jmp 0x786a
xorl %ebx, %ebx
movl 0x1c(%rsp), %edi
callq 0x9a70
movl %eax, %ebp
movzbl 0x1408c(%rip), %esi     # 0x1b908
leaq 0xa962(%rip), %rdi      # 0x121e5
callq 0x3fbf
callq 0x94ae
andb %bpl, %al
andb %bl, %al
movzbl %al, %edi
xorl %esi, %esi
callq 0x3ac9
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq