// File: /workspace/github_c_makefile_star2_O3/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 0xbbaa(%rip), %rdx      # 0x13217
movl $0x20, %esi
movl $0x20, %ecx
callq 0xc874
movq %rbx, %rdi
callq 0x9a21
movl %eax, %ebp
movzbl 0x1426b(%rip), %esi     # 0x1b8f8
leaq 0xbb91(%rip), %rbx      # 0x13225
movq %rbx, %rdi
callq 0x40a2
movq %rbx, %rdi
movl $0x100, %esi            # imm = 0x100
movl $0x100000, %edx         # imm = 0x100000
callq 0xa035
movl %eax, 0x1c(%rsp)
testl %eax, %eax
setne %bl
andb %bpl, %bl
movl $0xa, %r15d
testb $0x1, %bl
je 0x7bcc
movl %r15d, 0x18(%rsp)
movl $0x100, %edi            # imm = 0x100
callq 0xa10b
movb %al, 0x6(%rsp)
movl $0x100, %edi            # imm = 0x100
callq 0xa19c
movb %al, 0x5(%rsp)
movl $0x100000, %edi         # imm = 0x100000
callq 0xa154
movb %al, 0x4(%rsp)
movl $0x100000, %edi         # imm = 0x100000
callq 0xa1e5
movb %al, 0x13(%rsp)
leaq 0xbb31(%rip), %rdi      # 0x1323e
xorl %eax, %eax
callq 0x9a45
movb %al, 0x12(%rsp)
leaq 0xbb36(%rip), %rdi      # 0x13255
xorl %eax, %eax
callq 0x9b03
movb %al, 0x11(%rsp)
leaq 0xbb3a(%rip), %rdi      # 0x1326b
xorl %eax, %eax
callq 0x9bc1
movb %al, 0x10(%rsp)
leaq 0xbb40(%rip), %rdi      # 0x13283
xorl %eax, %eax
callq 0x9c7f
movb %al, 0xf(%rsp)
leaq 0xbb47(%rip), %rdi      # 0x1329c
xorl %eax, %eax
callq 0x9d3d
movb %al, 0xe(%rsp)
leaq 0xbb4c(%rip), %rdi      # 0x132b3
xorl %eax, %eax
callq 0x9dfb
movb %al, 0xd(%rsp)
leaq 0xbb54(%rip), %rdi      # 0x132cd
xorl %eax, %eax
callq 0x9eb9
movb %al, 0xc(%rsp)
leaq 0xbb59(%rip), %rdi      # 0x132e4
xorl %eax, %eax
callq 0x9f77
movl %eax, %ebx
movl $0xa, %edi
callq 0x408e
movl %eax, %r14d
movl %eax, %r15d
leaq 0xd675(%rip), %rbp      # 0x14e20
movzwl (%rbp,%r15,2), %edi
callq 0xa10b
movb %al, 0xb(%rsp)
leaq 0xd62f(%rip), %rax      # 0x14df0
movl (%rax,%r15,4), %edi
movq %rax, %r15
callq 0xa154
movb %al, 0x9(%rsp)
movl $0x1, %edi
leaq 0xbb22(%rip), %rsi      # 0x132ff
movl %r14d, %edx
xorl %eax, %eax
callq 0x3400
movl $0xa, %edi
callq 0x408e
movl %eax, %r14d
movl %eax, %r12d
movzwl (%rbp,%r12,2), %edi
callq 0xa19c
movb %al, 0xa(%rsp)
movl (%r15,%r12,4), %edi
callq 0xa1e5
movl %eax, %r12d
movl $0x1, %edi
leaq 0xbb18(%rip), %rsi      # 0x13336
movl %r14d, %edx
xorl %eax, %eax
callq 0x3400
movl $0xa, %edi
callq 0x408e
movl %eax, %r13d
movl %eax, %r14d
movzwl (%rbp,%r14,2), %esi
movl 0x1c(%rsp), %ebp
movl %ebp, %edi
callq 0xa049
movb %al, 0x8(%rsp)
movl (%r15,%r14,4), %esi
movl %ebp, %edi
callq 0xa08b
movb %al, 0x7(%rsp)
movl $0x1, %edi
leaq 0xbb05(%rip), %rsi      # 0x1336d
movl %r13d, %edx
leaq 0xb9b3(%rip), %rcx      # 0x13225
xorl %eax, %eax
callq 0x3400
leaq 0xbb20(%rip), %rdi      # 0x133a0
movl %r13d, %esi
xorl %eax, %eax
callq 0x9a45
testb %al, %al
leaq 0x30(%rsp), %r15
jne 0x78b2
xorl %ebp, %ebp
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
xorl %esi, %esi
callq 0x31f0
movq %r15, %rdi
callq 0x9a30
cmpw $0xd, %ax
jne 0x78b5
movb $0x1, %bpl
leaq 0xbb00(%rip), %rdi      # 0x133bc
movl %r13d, %esi
xorl %eax, %eax
callq 0x9b03
testb %al, %al
jne 0x78ea
xorl %r14d, %r14d
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
xorl %esi, %esi
callq 0x31f0
movq %r15, %rdi
callq 0x9a30
cmpw $0xd, %ax
jne 0x78ed
movb $0x1, %r14b
leaq 0xbae3(%rip), %rdi      # 0x133d7
movl %r13d, %esi
xorl %eax, %eax
callq 0x9bc1
testb %al, %al
jne 0x7927
movl $0x0, 0x14(%rsp)
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
xorl %esi, %esi
callq 0x31f0
movq %r15, %rdi
callq 0x9a30
cmpw $0xd, %ax
jne 0x792d
movb $0x1, %al
movl %eax, 0x14(%rsp)
movl %r14d, 0x28(%rsp)
leaq 0xbabb(%rip), %rdi      # 0x133f4
movl %r13d, %esi
xorl %eax, %eax
callq 0x9c7f
testb %al, %al
jne 0x7967
xorl %r14d, %r14d
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
xorl %esi, %esi
callq 0x31f0
movq %r15, %rdi
callq 0x9a30
cmpw $0xd, %ax
jne 0x796a
movb $0x1, %r14b
movl %r14d, 0x24(%rsp)
leaq 0xba9c(%rip), %rdi      # 0x13412
movl %r13d, %esi
xorl %eax, %eax
callq 0x9d3d
testb %al, %al
jne 0x79a4
xorl %r14d, %r14d
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
xorl %esi, %esi
callq 0x31f0
movq %r15, %rdi
callq 0x9a30
cmpw $0xd, %ax
jne 0x79a7
movb $0x1, %r14b
movl %ebp, 0x2c(%rsp)
leaq 0xba7c(%rip), %rdi      # 0x1342e
movl %r13d, %esi
xorl %eax, %eax
callq 0x9dfb
testb %al, %al
jne 0x79df
xorl %ebp, %ebp
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
xorl %esi, %esi
callq 0x31f0
movq %r15, %rdi
callq 0x9a30
cmpw $0xd, %ax
jne 0x79e2
movb $0x1, %bpl
movl %ebp, 0x20(%rsp)
leaq 0xba60(%rip), %rdi      # 0x1344d
movl %r13d, %esi
xorl %eax, %eax
callq 0x9eb9
testb %al, %al
jne 0x7a1a
xorl %ebp, %ebp
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
xorl %esi, %esi
callq 0x31f0
movq %r15, %rdi
callq 0x9a30
cmpw $0xd, %ax
jne 0x7a1d
movb $0x1, %bpl
leaq 0xba45(%rip), %rdi      # 0x13469
movl %r13d, %esi
xorl %eax, %eax
callq 0x9f77
testb %al, %al
movl 0x18(%rsp), %r15d
jne 0x7a67
xorl %r13d, %r13d
movl $0x100, %edx            # imm = 0x100
movl %r12d, %r15d
leaq 0x30(%rsp), %r12
movq %r12, %rdi
xorl %esi, %esi
callq 0x31f0
movq %r12, %rdi
movl %r15d, %r12d
movl 0x18(%rsp), %r15d
callq 0x9a30
cmpw $0xd, %ax
jne 0x7a6a
movb $0x1, %r13b
andb %r13b, %bpl
andb 0x20(%rsp), %r14b
andb %bpl, %r14b
movl 0x14(%rsp), %ecx
andb 0x24(%rsp), %cl
movl 0x28(%rsp), %eax
andb %cl, %al
andb %r14b, %al
movl 0x2c(%rsp), %edx
andb %al, %dl
andb 0x7(%rsp), %dl
movb 0x8(%rsp), %cl
andb %r12b, %cl
movb 0xa(%rsp), %al
andb 0x9(%rsp), %al
andb 0xb(%rsp), %al
andb %dl, %cl
andb %cl, %al
andb 0xc(%rsp), %bl
andb 0xd(%rsp), %bl
andb 0xe(%rsp), %bl
andb 0xf(%rsp), %bl
andb 0x10(%rsp), %bl
andb 0x11(%rsp), %bl
andb 0x12(%rsp), %bl
andb 0x13(%rsp), %bl
andb 0x4(%rsp), %bl
andb 0x5(%rsp), %bl
andb %al, %bl
andb 0x6(%rsp), %bl
decl %r15d
jne 0x76c0
testb $0x1, %bl
je 0x7bcc
movl $0x100, %edi            # imm = 0x100
callq 0xa10b
movb %al, 0x18(%rsp)
movl $0x100, %edi            # imm = 0x100
callq 0xa19c
movb %al, 0x14(%rsp)
movl $0x100000, %edi         # imm = 0x100000
callq 0xa154
movb %al, 0x6(%rsp)
movl $0x100000, %edi         # imm = 0x100000
callq 0xa1e5
movb %al, 0x5(%rsp)
leaq 0xb718(%rip), %rdi      # 0x1323e
xorl %eax, %eax
callq 0x9a45
movl %eax, %ebx
leaq 0xb71f(%rip), %rdi      # 0x13255
xorl %eax, %eax
callq 0x9b03
movb %al, 0x4(%rsp)
leaq 0xb723(%rip), %rdi      # 0x1326b
xorl %eax, %eax
callq 0x9bc1
movl %eax, %r14d
leaq 0xb72a(%rip), %rdi      # 0x13283
xorl %eax, %eax
callq 0x9c7f
movl %eax, %ebp
leaq 0xb733(%rip), %rdi      # 0x1329c
xorl %eax, %eax
callq 0x9d3d
movl %eax, %r15d
leaq 0xb739(%rip), %rdi      # 0x132b3
xorl %eax, %eax
callq 0x9dfb
movl %eax, %r12d
leaq 0xb742(%rip), %rdi      # 0x132cd
xorl %eax, %eax
callq 0x9eb9
movl %eax, %r13d
leaq 0xb748(%rip), %rdi      # 0x132e4
xorl %eax, %eax
callq 0x9f77
andb %r13b, %al
andb %r15b, %r12b
andb %al, %r12b
andb %r14b, %bpl
andb 0x4(%rsp), %bpl
andb %r12b, %bpl
andb 0x5(%rsp), %bl
andb 0x6(%rsp), %bl
andb 0x14(%rsp), %bl
andb %bpl, %bl
andb 0x18(%rsp), %bl
jmp 0x7bce
xorl %ebx, %ebx
movl 0x1c(%rsp), %edi
callq 0xa03a
movl %eax, %ebp
movzbl 0x13d18(%rip), %esi     # 0x1b8f8
leaq 0xb63e(%rip), %rdi      # 0x13225
callq 0x40a2
callq 0x9a26
andb %bpl, %al
andb %bl, %al
movzbl %al, %edi
xorl %esi, %esi
callq 0x3b6d
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq