// File: /workspace/github_c_makefile_star2_O1/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 $0x238, %rsp            # imm = 0x238
leaq 0x130(%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 0x218(%rsp), %rdi
leaq 0xbb72(%rip), %rdx      # 0x13217
movl $0x20, %esi
movl $0x20, %ecx
callq 0xc950
movq %rbx, %rdi
callq 0x9a31
movl %eax, %ebx
movzbl 0x14233(%rip), %esi     # 0x1b8f8
leaq 0xbb59(%rip), %r14      # 0x13225
movq %r14, %rdi
callq 0x4053
movq %r14, %rdi
movl $0x100, %esi            # imm = 0x100
movl $0x100000, %edx         # imm = 0x100000
callq 0xa045
movl %eax, 0x1c(%rsp)
testl %eax, %eax
setne %bpl
andb %bl, %bpl
movl $0xa, %r13d
testb $0x1, %bpl
je 0x7c07
movl %r13d, 0x18(%rsp)
movl $0x100, %edi            # imm = 0x100
callq 0xa11b
movb %al, 0x6(%rsp)
movl $0x100, %edi            # imm = 0x100
callq 0xa1ac
movb %al, 0x5(%rsp)
movl $0x100000, %edi         # imm = 0x100000
callq 0xa164
movb %al, 0x4(%rsp)
movl $0x100000, %edi         # imm = 0x100000
callq 0xa1f5
movb %al, 0x13(%rsp)
leaq 0xbaf7(%rip), %rdi      # 0x1323e
xorl %eax, %eax
callq 0x9a55
movb %al, 0x12(%rsp)
leaq 0xbafc(%rip), %rdi      # 0x13255
xorl %eax, %eax
callq 0x9b13
movb %al, 0x11(%rsp)
leaq 0xbb00(%rip), %rdi      # 0x1326b
xorl %eax, %eax
callq 0x9bd1
movb %al, 0x10(%rsp)
leaq 0xbb06(%rip), %rdi      # 0x13283
xorl %eax, %eax
callq 0x9c8f
movb %al, 0xf(%rsp)
leaq 0xbb0d(%rip), %rdi      # 0x1329c
xorl %eax, %eax
callq 0x9d4d
movb %al, 0xe(%rsp)
leaq 0xbb12(%rip), %rdi      # 0x132b3
xorl %eax, %eax
callq 0x9e0b
movb %al, 0xd(%rsp)
leaq 0xbb1a(%rip), %rdi      # 0x132cd
xorl %eax, %eax
callq 0x9ec9
movb %al, 0xc(%rsp)
leaq 0xbb1f(%rip), %rdi      # 0x132e4
xorl %eax, %eax
callq 0x9f87
movl %eax, %ebp
movl $0xa, %edi
callq 0x403f
movl %eax, %ebx
movl %eax, %r14d
leaq 0xd63c(%rip), %r15      # 0x14e20
movzwl (%r15,%r14,2), %edi
callq 0xa11b
movb %al, 0xb(%rsp)
leaq 0xd5f7(%rip), %r12      # 0x14df0
movl (%r12,%r14,4), %edi
callq 0xa164
movb %al, 0x9(%rsp)
movl $0x1, %edi
leaq 0xbaed(%rip), %rsi      # 0x132ff
movl %ebx, %edx
xorl %eax, %eax
callq 0x3400
movl $0xa, %edi
callq 0x403f
movl %eax, %ebx
movl %eax, %r14d
movzwl (%r15,%r14,2), %edi
callq 0xa1ac
movb %al, 0xa(%rsp)
movl (%r12,%r14,4), %edi
callq 0xa1f5
movb %al, 0x8(%rsp)
movl $0x1, %edi
leaq 0xbae5(%rip), %rsi      # 0x13336
movl %ebx, %edx
xorl %eax, %eax
callq 0x3400
movl $0xa, %edi
callq 0x403f
movl %eax, %r14d
movl %eax, %ebx
movzwl (%r15,%rbx,2), %esi
movl 0x1c(%rsp), %r15d
movl %r15d, %edi
callq 0xa059
movb %al, 0x7(%rsp)
movl (%r12,%rbx,4), %esi
movl %r15d, %edi
callq 0xa09b
movl %eax, %r15d
movl $0x1, %edi
leaq 0xbad3(%rip), %rsi      # 0x1336d
movl %r14d, %edx
leaq 0xb981(%rip), %rcx      # 0x13225
xorl %eax, %eax
callq 0x3400
leaq 0xbaee(%rip), %rdi      # 0x133a0
movl %r14d, %esi
xorl %eax, %eax
callq 0x9a55
testb %al, %al
leaq 0x30(%rsp), %r13
jne 0x78e4
xorl %ebx, %ebx
movl $0x100, %edx            # imm = 0x100
movq %r13, %rdi
xorl %esi, %esi
callq 0x31f0
movq %r13, %rdi
callq 0x9a40
cmpw $0xd, %ax
jne 0x78e6
movb $0x1, %bl
leaq 0xbacf(%rip), %rdi      # 0x133bc
movl %r14d, %esi
xorl %eax, %eax
callq 0x9b13
testb %al, %al
jne 0x791b
xorl %r12d, %r12d
movl $0x100, %edx            # imm = 0x100
movq %r13, %rdi
xorl %esi, %esi
callq 0x31f0
movq %r13, %rdi
callq 0x9a40
cmpw $0xd, %ax
jne 0x791e
movb $0x1, %r12b
leaq 0xbab2(%rip), %rdi      # 0x133d7
movl %r14d, %esi
xorl %eax, %eax
callq 0x9bd1
testb %al, %al
jne 0x7958
movl $0x0, 0x14(%rsp)
movl $0x100, %edx            # imm = 0x100
movq %r13, %rdi
xorl %esi, %esi
callq 0x31f0
movq %r13, %rdi
callq 0x9a40
cmpw $0xd, %ax
jne 0x795e
movb $0x1, %al
movl %eax, 0x14(%rsp)
movl %ebx, 0x2c(%rsp)
leaq 0xba8b(%rip), %rdi      # 0x133f4
movl %r14d, %esi
xorl %eax, %eax
callq 0x9c8f
testb %al, %al
jne 0x7996
xorl %ebx, %ebx
movl $0x100, %edx            # imm = 0x100
movq %r13, %rdi
xorl %esi, %esi
callq 0x31f0
movq %r13, %rdi
callq 0x9a40
cmpw $0xd, %ax
jne 0x7998
movb $0x1, %bl
movl %ebx, 0x24(%rsp)
leaq 0xba6f(%rip), %rdi      # 0x13412
movl %r14d, %esi
xorl %eax, %eax
callq 0x9d4d
testb %al, %al
jne 0x79d0
xorl %ebx, %ebx
movl $0x100, %edx            # imm = 0x100
movq %r13, %rdi
xorl %esi, %esi
callq 0x31f0
movq %r13, %rdi
callq 0x9a40
cmpw $0xd, %ax
jne 0x79d2
movb $0x1, %bl
movl %r12d, 0x28(%rsp)
leaq 0xba50(%rip), %rdi      # 0x1342e
movl %r14d, %esi
xorl %eax, %eax
callq 0x9e0b
testb %al, %al
jne 0x7a0c
xorl %r12d, %r12d
movl $0x100, %edx            # imm = 0x100
movq %r13, %rdi
xorl %esi, %esi
callq 0x31f0
movq %r13, %rdi
callq 0x9a40
cmpw $0xd, %ax
jne 0x7a0f
movb $0x1, %r12b
movl %r12d, 0x20(%rsp)
leaq 0xba32(%rip), %rdi      # 0x1344d
movl %r14d, %esi
xorl %eax, %eax
callq 0x9ec9
testb %al, %al
jne 0x7a49
xorl %r12d, %r12d
movl $0x100, %edx            # imm = 0x100
movq %r13, %rdi
xorl %esi, %esi
callq 0x31f0
movq %r13, %rdi
callq 0x9a40
cmpw $0xd, %ax
jne 0x7a4c
movb $0x1, %r12b
leaq 0xba16(%rip), %rdi      # 0x13469
movl %r14d, %esi
xorl %eax, %eax
callq 0x9f87
testb %al, %al
movl 0x18(%rsp), %r13d
jne 0x7a96
xorl %r14d, %r14d
movl $0x100, %edx            # imm = 0x100
movl %r15d, %r13d
leaq 0x30(%rsp), %r15
movq %r15, %rdi
xorl %esi, %esi
callq 0x31f0
movq %r15, %rdi
movl %r13d, %r15d
movl 0x18(%rsp), %r13d
callq 0x9a40
cmpw $0xd, %ax
jne 0x7a99
movb $0x1, %r14b
andb %r14b, %r12b
andb 0x20(%rsp), %bl
andb %r12b, %bl
movl 0x14(%rsp), %ecx
andb 0x24(%rsp), %cl
movl 0x28(%rsp), %eax
andb %cl, %al
andb %bl, %al
movl 0x2c(%rsp), %edx
andb %al, %dl
andb %r15b, %dl
movb 0x7(%rsp), %cl
andb 0x8(%rsp), %cl
movb 0xa(%rsp), %al
andb 0x9(%rsp), %al
andb 0xb(%rsp), %al
andb %dl, %cl
andb %cl, %al
andb 0xc(%rsp), %bpl
andb 0xd(%rsp), %bpl
andb 0xe(%rsp), %bpl
andb 0xf(%rsp), %bpl
andb 0x10(%rsp), %bpl
andb 0x11(%rsp), %bpl
andb 0x12(%rsp), %bpl
andb 0x13(%rsp), %bpl
andb 0x4(%rsp), %bpl
andb 0x5(%rsp), %bpl
andb %al, %bpl
andb 0x6(%rsp), %bpl
decl %r13d
jne 0x76f9
testb $0x1, %bpl
je 0x7c07
movl $0x100, %edi            # imm = 0x100
callq 0xa11b
movb %al, 0x18(%rsp)
movl $0x100, %edi            # imm = 0x100
callq 0xa1ac
movb %al, 0x14(%rsp)
movl $0x100000, %edi         # imm = 0x100000
callq 0xa164
movb %al, 0x6(%rsp)
movl $0x100000, %edi         # imm = 0x100000
callq 0xa1f5
movb %al, 0x5(%rsp)
leaq 0xb6de(%rip), %rdi      # 0x1323e
xorl %eax, %eax
callq 0x9a55
movl %eax, %ebp
leaq 0xb6e5(%rip), %rdi      # 0x13255
xorl %eax, %eax
callq 0x9b13
movb %al, 0x4(%rsp)
leaq 0xb6e9(%rip), %rdi      # 0x1326b
xorl %eax, %eax
callq 0x9bd1
movl %eax, %r14d
leaq 0xb6f0(%rip), %rdi      # 0x13283
xorl %eax, %eax
callq 0x9c8f
movl %eax, %ebx
leaq 0xb6f9(%rip), %rdi      # 0x1329c
xorl %eax, %eax
callq 0x9d4d
movl %eax, %r15d
leaq 0xb6ff(%rip), %rdi      # 0x132b3
xorl %eax, %eax
callq 0x9e0b
movl %eax, %r12d
leaq 0xb708(%rip), %rdi      # 0x132cd
xorl %eax, %eax
callq 0x9ec9
movl %eax, %r13d
leaq 0xb70e(%rip), %rdi      # 0x132e4
xorl %eax, %eax
callq 0x9f87
andb %r13b, %al
andb %r15b, %r12b
andb %al, %r12b
andb %r14b, %bl
andb 0x4(%rsp), %bl
andb %r12b, %bl
andb 0x5(%rsp), %bpl
andb 0x6(%rsp), %bpl
andb 0x14(%rsp), %bpl
andb %bl, %bpl
andb 0x18(%rsp), %bpl
movl 0x1c(%rsp), %edi
callq 0xa04a
movl %eax, %ebx
movzbl 0x13cdf(%rip), %esi     # 0x1b8f8
leaq 0xb605(%rip), %rdi      # 0x13225
callq 0x4053
callq 0x9a36
andb %bl, %al
andb %bpl, %al
movzbl %al, %edi
xorl %esi, %esi
callq 0x3b04
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq