// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirinternal.c
// Function: sir_syslog_init
bool _sir_syslog_init(const char* name, sir_syslog_dest* ctx) {
#if !defined(SIR_NO_SYSTEM_LOGGERS)
    if (!_sir_validptr(name) || !_sir_validptr(ctx))
        return false;

    /* begin resolve identity. */
    if (!_sir_validstrnofail(ctx->identity)) {
        _sir_selflog("ctx->identity is no good; trying name");
        if (_sir_validstrnofail(name)) {
            _sir_selflog("using name");
            (void)_sir_strncpy(ctx->identity, SIR_MAX_SYSLOG_ID, name, strnlen(name, SIR_MAX_SYSLOG_ID));
        } else {
            _sir_selflog("name is no good; trying filename");
            char* appbasename = _sir_getappbasename();
            if (_sir_validstrnofail(appbasename)) {
                _sir_selflog("filename is good: %s", appbasename);
                (void)_sir_strncpy(ctx->identity, SIR_MAX_SYSLOG_ID, appbasename,
                    strnlen(appbasename, SIR_MAX_SYSLOG_ID));
            } else {
                _sir_selflog("filename no good; using fallback");
                (void)_sir_strncpy(ctx->identity, SIR_MAX_SYSLOG_ID, SIR_FALLBACK_SYSLOG_ID,
                    strnlen(SIR_FALLBACK_SYSLOG_ID, SIR_MAX_SYSLOG_ID));
            }
            _sir_safefree(&appbasename);
        }
    } else {
        _sir_selflog("already have identity");
    }

    /* category */
    if (!_sir_validstrnofail(ctx->category)) {
        _sir_selflog("category not set; using fallback");
        (void)_sir_strncpy(ctx->category, SIR_MAX_SYSLOG_CAT, SIR_FALLBACK_SYSLOG_CAT,
            strnlen(SIR_FALLBACK_SYSLOG_CAT, SIR_MAX_SYSLOG_CAT));
    } else {
        _sir_selflog("already have category");
    }

    _sir_setbitshigh(&ctx->_state.mask, SIRSL_IS_INIT);
    _sir_selflog("resolved (identity: '%s', category: '%s')", ctx->identity, ctx->category);

    return _sir_syslog_open(ctx);
#else
    SIR_UNUSED(name);
    SIR_UNUSED(ctx);
    return false;
#endif
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x3f9c(%rip), %rdx      # 0x9c98
pushq $0x1
popq %rsi
movl $0x366, %ecx            # imm = 0x366
callq 0x5923
testb %al, %al
je 0x5d63
leaq 0x3f84(%rip), %rdx      # 0x9c98
pushq $0x1
popq %rsi
movq %rbx, %rdi
movl $0x366, %ecx            # imm = 0x366
callq 0x5923
testb %al, %al
je 0x5d63
cmpb $0x0, 0x18(%rbx)
jne 0x5dbf
leaq 0x18(%rbx), %r14
testq %r15, %r15
je 0x5d6a
cmpb $0x0, (%r15)
je 0x5d6a
movl $0x80, %esi
movq %r15, %rdi
callq 0x21c0
movl $0x80, %esi
movq %r14, %rdi
movq %r15, %rdx
movq %rax, %rcx
callq 0x5401
jmp 0x5dbf
xorl %eax, %eax
jmp 0x5ded
callq 0x4ebf
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x5d9e
movq %rax, %r15
cmpb $0x0, (%rax)
je 0x5d9e
movl $0x80, %esi
movq %r15, %rdi
callq 0x21c0
movl $0x80, %esi
movq %r14, %rdi
movq %r15, %rdx
movq %rax, %rcx
jmp 0x5db0
leaq 0x3867(%rip), %rdx      # 0x960c
pushq $0x6
popq %rcx
movl $0x80, %esi
movq %r14, %rdi
callq 0x5401
leaq 0x8(%rsp), %rdi
callq 0x5098
cmpb $0x0, 0x98(%rbx)
jne 0x5de1
leaq 0x98(%rbx), %rdi
leaq 0x3ed3(%rip), %rdx      # 0x9ca9
pushq $0x40
popq %rsi
pushq $0x7
popq %rcx
callq 0x5401
orb $0x40, 0x8(%rbx)
movq %rbx, %rdi
callq 0x71f9
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq