// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq 0x48(%rsp), %rdi
movl $0x1, %esi
leaq 0x7c0b(%rip), %rdx      # 0x113ea
leaq 0x78b0(%rip), %rcx      # 0x11096
movl $0x366, %r8d            # imm = 0x366
callq 0x8f70
testb $0x1, %al
jne 0x97f7
jmp 0x981e
movq 0x40(%rsp), %rdi
movl $0x1, %esi
leaq 0x7be2(%rip), %rdx      # 0x113ea
leaq 0x7887(%rip), %rcx      # 0x11096
movl $0x366, %r8d            # imm = 0x366
callq 0x8f70
testb $0x1, %al
jne 0x9828
movb $0x0, 0x57(%rsp)
jmp 0x9a93
movq 0x40(%rsp), %rdi
addq $0x18, %rdi
xorl %esi, %esi
leaq 0x7bb0(%rip), %rdx      # 0x113ea
leaq 0x7855(%rip), %rcx      # 0x11096
movl $0x36a, %r8d            # imm = 0x36A
callq 0xa720
testb $0x1, %al
jne 0x99bc
leaq 0x7ba0(%rip), %rdi      # 0x113fb
movb $0x0, %al
callq 0x9730
movq 0x48(%rsp), %rdi
xorl %esi, %esi
leaq 0x7b7a(%rip), %rdx      # 0x113ea
leaq 0x781f(%rip), %rcx      # 0x11096
movl $0x36c, %r8d            # imm = 0x36C
callq 0xa720
testb $0x1, %al
jne 0x9888
jmp 0x98d9
leaq 0x7b92(%rip), %rdi      # 0x11421
movb $0x0, %al
callq 0x9730
movq 0x40(%rsp), %rax
addq $0x18, %rax
movq %rax, 0x28(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x48(%rsp), %rdi
movl $0x80, %esi
callq 0x21d0
movq 0x28(%rsp), %rdi
movq 0x30(%rsp), %rdx
movq %rax, %rcx
movl $0x80, %esi
callq 0x83d0
jmp 0x99ba
leaq 0x7b4c(%rip), %rdi      # 0x1142c
movb $0x0, %al
callq 0x9730
callq 0x75b0
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rdi
xorl %esi, %esi
leaq 0x7aeb(%rip), %rdx      # 0x113ea
leaq 0x7790(%rip), %rcx      # 0x11096
movl $0x372, %r8d            # imm = 0x372
callq 0xa720
testb $0x1, %al
jne 0x9917
jmp 0x996a
movq 0x38(%rsp), %rsi
leaq 0x7b2a(%rip), %rdi      # 0x1144d
movb $0x0, %al
callq 0x9730
movq 0x40(%rsp), %rax
addq $0x18, %rax
movq %rax, 0x18(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x38(%rsp), %rdi
movl $0x80, %esi
callq 0x21d0
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rdx
movq %rax, %rcx
movl $0x80, %esi
callq 0x83d0
jmp 0x99b0
leaq 0x7af1(%rip), %rdi      # 0x11462
movb $0x0, %al
callq 0x9730
movq 0x40(%rsp), %rax
addq $0x18, %rax
movq %rax, 0x10(%rsp)
leaq 0x6ccc(%rip), %rdi      # 0x10659
movl $0x80, %esi
callq 0x21d0
movq 0x10(%rsp), %rdi
movq %rax, %rcx
movl $0x80, %esi
leaq 0x6cae(%rip), %rdx      # 0x10659
callq 0x83d0
leaq 0x38(%rsp), %rdi
callq 0x7910
jmp 0x99ca
leaq 0x7ac0(%rip), %rdi      # 0x11483
movb $0x0, %al
callq 0x9730
movq 0x40(%rsp), %rdi
addq $0x98, %rdi
xorl %esi, %esi
leaq 0x7a0b(%rip), %rdx      # 0x113ea
leaq 0x76b0(%rip), %rcx      # 0x11096
movl $0x382, %r8d            # imm = 0x382
callq 0xa720
testb $0x1, %al
jne 0x9a3f
leaq 0x7a9d(%rip), %rdi      # 0x11499
movb $0x0, %al
callq 0x9730
movq 0x40(%rsp), %rax
addq $0x98, %rax
movq %rax, 0x8(%rsp)
leaq 0x7aa0(%rip), %rdi      # 0x114ba
movl $0x40, %esi
callq 0x21d0
movq 0x8(%rsp), %rdi
movq %rax, %rcx
movl $0x40, %esi
leaq 0x7a82(%rip), %rdx      # 0x114ba
callq 0x83d0
jmp 0x9a4d
leaq 0x7a7c(%rip), %rdi      # 0x114c2
movb $0x0, %al
callq 0x9730
movq 0x40(%rsp), %rdi
addq $0x8, %rdi
movl $0x40, %esi
callq 0xa200
movq 0x40(%rsp), %rsi
addq $0x18, %rsi
movq 0x40(%rsp), %rdx
addq $0x98, %rdx
leaq 0x7a5c(%rip), %rdi      # 0x114d8
movb $0x0, %al
callq 0x9730
movq 0x40(%rsp), %rdi
callq 0xc670
andb $0x1, %al
movb %al, 0x57(%rsp)
movb 0x57(%rsp), %al
andb $0x1, %al
addq $0x58, %rsp
retq
nop