// File: /workspace/github_c_makefile_star2_O0/aremmell[P]libsir/tests/tests.c
// Function: generic_syslog_test
static
bool generic_syslog_test(const char* sl_name, const char* identity, const char* category) {
    static const int runs = 5;

    /* repeat initializing, opening, logging, closing, cleaning up n times. */
    (void)printf("\trunning %d passes of random configs (system logger: '%s', "
                 "identity: '%s', category: '%s')..." SIR_EOL, runs, sl_name, identity, category);

# if !defined(__WIN__)
    uint32_t rnd = (uint32_t)(_sir_getpid() + _sir_gettid());
# else
    uint32_t rnd = (uint32_t)GetTickCount64();
# endif

    bool pass = true;
    for (int i = 1; i <= runs; i++) {
        /* randomly skip setting process name, identity/category to thoroughly
         * test fallback routines; randomly update the config mid-run. */
        bool set_procname = getrand_bool(rnd ^ 0x5a5a5a5aU);
        bool set_identity = getrand_bool(rnd ^ 0xc9c9c9c9U);
        bool set_category = getrand_bool(rnd ^ 0x32323232U);
        bool do_update    = getrand_bool(rnd ^ 0xe7e7e7e7U);

        TEST_MSG("set_procname: %d, set_identity: %d, set_category: %d, do_update: %d",
            set_procname, set_identity, set_category, do_update);

        INIT_SL(si, SIRL_ALL, SIRO_NOHOST | SIRO_NOTID, 0, 0, (set_procname ? "sir_sltest" : ""));
        si.d_syslog.opts   = SIRO_DEFAULT;
        si.d_syslog.levels = SIRL_DEFAULT;

        if (set_identity)
            (void)_sir_strncpy(si.d_syslog.identity, SIR_MAX_SYSLOG_CAT, identity, SIR_MAX_SYSLOG_ID);

        if (set_category)
            (void)_sir_strncpy(si.d_syslog.category, SIR_MAX_SYSLOG_CAT, category, SIR_MAX_SYSLOG_CAT);

        _sir_eqland(pass, sir_init(&si));

        if (do_update)
            _sir_eqland(pass, sir_sysloglevels(SIRL_ALL));

        _sir_eqland(pass, sir_debug("%d/%d: this debug message sent to stdout and %s.", i, runs, sl_name));
        _sir_eqland(pass, sir_info("%d/%d: this info message sent to stdout and %s.", i, runs, sl_name));

        _sir_eqland(pass, sir_notice("%d/%d: this notice message sent to stdout and %s.", i, runs, sl_name));
        _sir_eqland(pass, sir_warn("%d/%d: this warning message sent to stdout and %s.", i, runs, sl_name));
        _sir_eqland(pass, sir_error("%d/%d: this error message sent to stdout and %s.", i, runs, sl_name));

        if (set_identity) {
            _sir_eqland(pass, sir_syslogid("my test ID"));
            _sir_eqland(pass, sir_syslogid("my test ID")); /* test deduping. */
        }

        if (set_category) {
            _sir_eqland(pass, sir_syslogcat("my test category"));
            _sir_eqland(pass, sir_syslogcat("my test category")); /* test deduping. */
        }

        if (do_update)
            _sir_eqland(pass, sir_syslogopts(SIRO_MSGONLY & ~(SIRO_NOLEVEL | SIRO_NOPID)));

        _sir_eqland(pass, sir_crit("%d/%d: this critical message sent to stdout and %s.", i, runs, sl_name));
        _sir_eqland(pass, sir_alert("%d/%d: this alert message sent to stdout and %s.", i, runs, sl_name));
        _sir_eqland(pass, sir_emerg("%d/%d: this emergency message sent to stdout and %s.", i, runs, sl_name));

# if defined(SIR_OS_LOG_ENABLED)
#  if defined(__MACOS__) && !defined(__INTEL_COMPILER)
        if (i == runs -1 && 0 == strncmp(sl_name, "os_log", 6)) {
            TEST_MSG_0("testing os_log activity feature...");

            /* also test activity grouping in Console. there's only one way to validate
             * this and that's by manually viewing the log. */
            os_activity_t parent = os_activity_create("flying to the moon", //-V530
                OS_ACTIVITY_NONE, OS_ACTIVITY_FLAG_DETACHED);

            /* execution now passes to os_log_parent_activity(), where some logging
             * will occur, then a sub-activity will be created, and more logging. */
            os_activity_apply_f(parent, (void*)parent, os_log_parent_activity);
        }
#  endif
# endif

        _sir_eqland(pass, sir_cleanup());

        if (!pass)
            break;
    }

    return PRINT_RESULT_RETURN(pass);
}

// Assembly:
subq $0x148, %rsp            # imm = 0x148
movq %rdi, 0x140(%rsp)
movq %rsi, 0x138(%rsp)
movq %rdx, 0x130(%rsp)
movq 0x140(%rsp), %rdx
movq 0x138(%rsp), %rcx
movq 0x130(%rsp), %r8
leaq 0x14af2(%rip), %rdi     # 0x20cc0
movl $0x5, %esi
movb $0x0, %al
callq 0x4180
callq 0x162c0
movl %eax, 0x10(%rsp)
callq 0x18410
movl %eax, %ecx
movl 0x10(%rsp), %eax
addl %ecx, %eax
movl %eax, 0x12c(%rsp)
movb $0x1, 0x12b(%rsp)
movl $0x1, 0x124(%rsp)
cmpl $0x5, 0x124(%rsp)
jg 0xc7f1
movl 0x12c(%rsp), %edi
xorl $0x5a5a5a5a, %edi       # imm = 0x5A5A5A5A
callq 0xf500
andb $0x1, %al
movb %al, 0x123(%rsp)
movl 0x12c(%rsp), %edi
xorl $0xc9c9c9c9, %edi       # imm = 0xC9C9C9C9
callq 0xf500
andb $0x1, %al
movb %al, 0x122(%rsp)
movl 0x12c(%rsp), %edi
xorl $0x32323232, %edi       # imm = 0x32323232
callq 0xf500
andb $0x1, %al
movb %al, 0x121(%rsp)
movl 0x12c(%rsp), %edi
xorl $0xe7e7e7e7, %edi       # imm = 0xE7E7E7E7
callq 0xf500
andb $0x1, %al
movb %al, 0x120(%rsp)
movb 0x123(%rsp), %al
andb $0x1, %al
movzbl %al, %esi
movb 0x122(%rsp), %al
andb $0x1, %al
movzbl %al, %edx
movb 0x121(%rsp), %al
andb $0x1, %al
movzbl %al, %ecx
movb 0x120(%rsp), %al
andb $0x1, %al
movzbl %al, %r8d
leaq 0x14a63(%rip), %rdi     # 0x20d1f
movb $0x0, %al
callq 0x4180
leaq 0x18(%rsp), %rdi
xorl %esi, %esi
movl $0x108, %edx            # imm = 0x108
callq 0x4210
movl $0x4400, 0x1c(%rsp)     # imm = 0x4400
movw $0xff, 0x18(%rsp)
movl $0x100000, 0x24(%rsp)   # imm = 0x100000
movw $0x0, 0x20(%rsp)
movb 0x123(%rsp), %cl
leaq 0x10fc7(%rip), %rdi     # 0x1d2c7
leaq 0x14a5e(%rip), %rax     # 0x20d65
testb $0x1, %cl
cmovneq %rax, %rdi
xorl %esi, %esi
leaq 0x14a59(%rip), %rdx     # 0x20d70
leaq 0x1120f(%rip), %rcx     # 0x1d52d
movl $0x573, %r8d            # imm = 0x573
callq 0x5ce0
testb $0x1, %al
jne 0xc32f
jmp 0xc364
leaq 0x18(%rsp), %rdi
addq $0xe8, %rdi
movb 0x123(%rsp), %cl
leaq 0x10f7e(%rip), %rdx     # 0x1d2c7
leaq 0x14a15(%rip), %rax     # 0x20d65
testb $0x1, %cl
cmovneq %rax, %rdx
movl $0x20, %ecx
movq %rcx, %rsi
callq 0x14f50
movb $0x0, 0x17(%rsp)
movl $0x100000, 0x2c(%rsp)   # imm = 0x100000
movw $0x100, 0x28(%rsp)      # imm = 0x100
testb $0x1, 0x122(%rsp)
je 0xc3a6
leaq 0x18(%rsp), %rdi
addq $0x10, %rdi
addq $0x18, %rdi
movq 0x138(%rsp), %rdx
movl $0x40, %esi
movl $0x80, %ecx
callq 0x14f50
testb $0x1, 0x121(%rsp)
je 0xc3d5
leaq 0x18(%rsp), %rdi
addq $0x10, %rdi
addq $0x98, %rdi
movq 0x130(%rsp), %rdx
movl $0x40, %ecx
movq %rcx, %rsi
callq 0x14f50
leaq 0x18(%rsp), %rdi
callq 0xf560
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0xf(%rsp)
jne 0xc3ee
jmp 0xc3f9
movb 0x12b(%rsp), %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
andb $0x1, %al
movb %al, 0x12b(%rsp)
testb $0x1, 0x120(%rsp)
je 0xc441
movl $0xff, %edi
callq 0x10330
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0xe(%rsp)
jne 0xc429
jmp 0xc434
movb 0x12b(%rsp), %al
movb %al, 0xe(%rsp)
movb 0xe(%rsp), %al
andb $0x1, %al
movb %al, 0x12b(%rsp)
movl 0x124(%rsp), %esi
movq 0x140(%rsp), %rcx
leaq 0x1492d(%rip), %rdi     # 0x20d84
movl $0x5, %edx
movb $0x0, %al
callq 0xf5f0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0xd(%rsp)
jne 0xc472
jmp 0xc47d
movb 0x12b(%rsp), %al
movb %al, 0xd(%rsp)
movb 0xd(%rsp), %al
andb $0x1, %al
movb %al, 0x12b(%rsp)
movl 0x124(%rsp), %esi
movq 0x140(%rsp), %rcx
leaq 0x14915(%rip), %rdi     # 0x20db5
movl $0x5, %edx
movb $0x0, %al
callq 0xf770
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0xc(%rsp)
jne 0xc4bb
jmp 0xc4c6
movb 0x12b(%rsp), %al
movb %al, 0xc(%rsp)
movb 0xc(%rsp), %al
andb $0x1, %al
movb %al, 0x12b(%rsp)
movl 0x124(%rsp), %esi
movq 0x140(%rsp), %rcx
leaq 0x148fc(%rip), %rdi     # 0x20de5
movl $0x5, %edx
movb $0x0, %al
callq 0xf880
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0xb(%rsp)
jne 0xc504
jmp 0xc50f
movb 0x12b(%rsp), %al
movb %al, 0xb(%rsp)
movb 0xb(%rsp), %al
andb $0x1, %al
movb %al, 0x12b(%rsp)
movl 0x124(%rsp), %esi
movq 0x140(%rsp), %rcx
leaq 0x148e5(%rip), %rdi     # 0x20e17
movl $0x5, %edx
movb $0x0, %al
callq 0xf990
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0xa(%rsp)
jne 0xc54d
jmp 0xc558
movb 0x12b(%rsp), %al
movb %al, 0xa(%rsp)
movb 0xa(%rsp), %al
andb $0x1, %al
movb %al, 0x12b(%rsp)
movl 0x124(%rsp), %esi
movq 0x140(%rsp), %rcx
leaq 0x148cf(%rip), %rdi     # 0x20e4a
movl $0x5, %edx
movb $0x0, %al
callq 0xfaa0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x9(%rsp)
jne 0xc596
jmp 0xc5a1
movb 0x12b(%rsp), %al
movb %al, 0x9(%rsp)
movb 0x9(%rsp), %al
andb $0x1, %al
movb %al, 0x12b(%rsp)
testb $0x1, 0x122(%rsp)
je 0xc61e
leaq 0x148bc(%rip), %rdi     # 0x20e7b
callq 0x103f0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x8(%rsp)
jne 0xc5d3
jmp 0xc5de
movb 0x12b(%rsp), %al
movb %al, 0x8(%rsp)
movb 0x8(%rsp), %al
andb $0x1, %al
movb %al, 0x12b(%rsp)
leaq 0x14889(%rip), %rdi     # 0x20e7b
callq 0x103f0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x7(%rsp)
jne 0xc606
jmp 0xc611
movb 0x12b(%rsp), %al
movb %al, 0x7(%rsp)
movb 0x7(%rsp), %al
andb $0x1, %al
movb %al, 0x12b(%rsp)
testb $0x1, 0x121(%rsp)
je 0xc68e
leaq 0x14857(%rip), %rdi     # 0x20e86
callq 0x10440
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x6(%rsp)
jne 0xc643
jmp 0xc64e
movb 0x12b(%rsp), %al
movb %al, 0x6(%rsp)
movb 0x6(%rsp), %al
andb $0x1, %al
movb %al, 0x12b(%rsp)
leaq 0x14824(%rip), %rdi     # 0x20e86
callq 0x10440
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x5(%rsp)
jne 0xc676
jmp 0xc681
movb 0x12b(%rsp), %al
movb %al, 0x5(%rsp)
movb 0x5(%rsp), %al
andb $0x1, %al
movb %al, 0x12b(%rsp)
testb $0x1, 0x120(%rsp)
je 0xc6c9
movl $0x5700, %edi           # imm = 0x5700
callq 0x10390
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x4(%rsp)
jne 0xc6b1
jmp 0xc6bc
movb 0x12b(%rsp), %al
movb %al, 0x4(%rsp)
movb 0x4(%rsp), %al
andb $0x1, %al
movb %al, 0x12b(%rsp)
movl 0x124(%rsp), %esi
movq 0x140(%rsp), %rcx
leaq 0x147b8(%rip), %rdi     # 0x20e97
movl $0x5, %edx
movb $0x0, %al
callq 0xfbb0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x3(%rsp)
jne 0xc6fa
jmp 0xc705
movb 0x12b(%rsp), %al
movb %al, 0x3(%rsp)
movb 0x3(%rsp), %al
andb $0x1, %al
movb %al, 0x12b(%rsp)
movl 0x124(%rsp), %esi
movq 0x140(%rsp), %rcx
leaq 0x147a3(%rip), %rdi     # 0x20ecb
movl $0x5, %edx
movb $0x0, %al
callq 0xfcc0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x2(%rsp)
jne 0xc743
jmp 0xc74e
movb 0x12b(%rsp), %al
movb %al, 0x2(%rsp)
movb 0x2(%rsp), %al
andb $0x1, %al
movb %al, 0x12b(%rsp)
movl 0x124(%rsp), %esi
movq 0x140(%rsp), %rcx
leaq 0x1478b(%rip), %rdi     # 0x20efc
movl $0x5, %edx
movb $0x0, %al
callq 0xfdd0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x1(%rsp)
jne 0xc78c
jmp 0xc797
movb 0x12b(%rsp), %al
movb %al, 0x1(%rsp)
movb 0x1(%rsp), %al
andb $0x1, %al
movb %al, 0x12b(%rsp)
callq 0xf580
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, (%rsp)
jne 0xc7b7
jmp 0xc7c1
movb 0x12b(%rsp), %al
movb %al, (%rsp)
movb (%rsp), %al
andb $0x1, %al
movb %al, 0x12b(%rsp)
testb $0x1, 0x12b(%rsp)
jne 0xc7d9
jmp 0xc7f1
jmp 0xc7db
movl 0x124(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x124(%rsp)
jmp 0xc20a
movb 0x12b(%rsp), %al
xorl %esi, %esi
andb $0x1, %al
movzbl %al, %edi
callq 0x4da0
andb $0x1, %al
addq $0x148, %rsp            # imm = 0x148
retq
nop