// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirinternal.c
// Function: sir_dispatch
bool _sir_dispatch(const sirinit* si, sir_level level, sirbuf* buf) {
    bool retval       = true;
    size_t dispatched = 0;
    size_t wanted     = 0;

#if !defined(SIR_NO_TEXT_STYLING)
    static const bool styling = true;
#else
    static const bool styling = false;
#endif

    if (_sir_bittest(si->d_stdout.levels, level)) {
        const char* writef = _sir_format(styling, si->d_stdout.opts, buf);
        bool wrote         = _sir_validstrnofail(writef) &&
            _sir_write_stdout(writef, buf->output_len);
        _sir_eqland(retval, wrote);

        if (wrote)
            dispatched++;
        wanted++;
    }

    if (_sir_bittest(si->d_stderr.levels, level)) {
        const char* writef = _sir_format(styling, si->d_stderr.opts, buf);
        bool wrote         = _sir_validstrnofail(writef) &&
            _sir_write_stderr(writef, buf->output_len);
        _sir_eqland(retval, wrote);

        if (wrote)
            dispatched++;
        wanted++;
    }

#if !defined(SIR_NO_SYSTEM_LOGGERS)
    if (_sir_bittest(si->d_syslog.levels, level)) {
        if (_sir_syslog_write(level, buf, &si->d_syslog))
            dispatched++;
        wanted++;
    }
#endif

    _SIR_LOCK_SECTION(const sirfcache, sfc, SIRMI_FILECACHE, false);
    size_t fdispatched = 0;
    size_t fwanted     = 0;
    _sir_eqland(retval, _sir_fcache_dispatch(sfc, level, buf, &fdispatched, &fwanted));
    _SIR_UNLOCK_SECTION(SIRMI_FILECACHE);

    dispatched += fdispatched;
    wanted += fwanted;

#if !defined(SIR_NO_PLUGINS)
    _SIR_LOCK_SECTION(const sir_plugincache, spc, SIRMI_PLUGINCACHE, false);
    size_t pdispatched = 0;
    size_t pwanted     = 0;
    _sir_eqland(retval, _sir_plugin_cache_dispatch(spc, level, buf, &pdispatched, &pwanted));
    _SIR_UNLOCK_SECTION(SIRMI_PLUGINCACHE);

    dispatched += pdispatched;
    wanted += pwanted;
#endif

    if (0 == wanted) {
        _sir_selflog("error: no destinations registered for level %04"PRIx16, level);
        return _sir_seterror(_SIR_E_NODEST);
    }

    return retval && (dispatched == wanted);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r15
movl (%rdi), %eax
notl %eax
testl %eax, %esi
jne 0x6cde
movl 0x4(%r15), %esi
pushq $0x1
popq %rdi
movq %rbx, %rdx
callq 0x6e84
pushq $0x1
popq %r14
testq %rax, %rax
je 0x6ce9
cmpb $0x0, (%rax)
je 0x6ce9
movq 0x8312(%rip), %rcx      # 0xefd8
movq (%rcx), %rdi
movq %rax, %rsi
callq 0x84ec
movl %eax, %r12d
movzbl %al, %r13d
andl $0x1, %r13d
jmp 0x6cef
movb $0x1, %r12b
xorl %r14d, %r14d
xorl %r13d, %r13d
jmp 0x6cef
xorl %r13d, %r13d
xorl %r12d, %r12d
movl 0x8(%r15), %eax
notl %eax
testw %ax, %bp
jne 0x6d33
movl 0xc(%r15), %esi
pushq $0x1
popq %rdi
movq %rbx, %rdx
callq 0x6e84
testq %rax, %rax
je 0x6d3a
cmpb $0x0, (%rax)
je 0x6d3a
movq 0x82de(%rip), %rcx      # 0xeff8
movq (%rcx), %rdi
movq %rax, %rsi
callq 0x84ec
andb %al, %r12b
movzbl %al, %eax
andl $0x1, %eax
addq %rax, %r13
jmp 0x6d3d
movq %r12, 0x8(%rsp)
jmp 0x6d45
xorl %r12d, %r12d
movq %r12, 0x8(%rsp)
incq %r14
movl 0x10(%r15), %eax
notl %eax
movzwl %bp, %r12d
testw %ax, %bp
jne 0x6d6f
addq $0x10, %r15
movl %r12d, %edi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x714f
movzbl %al, %eax
addq %rax, %r13
incq %r14
pushq $0x1
popq %rdi
callq 0x5c53
testq %rax, %rax
je 0x6e1d
movq %r13, 0x10(%rsp)
leaq 0x30(%rsp), %r15
andq $0x0, (%r15)
leaq 0x28(%rsp), %r13
andq $0x0, (%r13)
movq %rax, %rdi
movl %r12d, %esi
movq %rbx, %rdx
movq %r15, %rcx
movq %r13, %r8
callq 0x47ad
movb %al, 0x7(%rsp)
pushq $0x1
popq %rdi
callq 0x5df7
movq (%r15), %rbp
movq (%r13), %r13
pushq $0x2
popq %rdi
callq 0x5c53
testq %rax, %rax
je 0x6e37
addq %r14, %r13
leaq 0x18(%rsp), %rcx
andq $0x0, (%rcx)
leaq 0x20(%rsp), %r15
andq $0x0, (%r15)
movq %rax, %rdi
movl %r12d, %esi
movq %rbx, %rdx
movq %r15, %r8
callq 0x7cfa
movl %eax, %ebx
pushq $0x2
popq %rdi
callq 0x5df7
addq (%r15), %r13
je 0x6e65
addq 0x10(%rsp), %rbp
addq 0x18(%rsp), %rbp
andb 0x7(%rsp), %bl
andb 0x8(%rsp), %bl
cmpq %r13, %rbp
sete %al
andb %bl, %al
jmp 0x6e56
leaq 0x2e50(%rip), %rsi      # 0x9c74
leaq 0x2d7b(%rip), %rdx      # 0x9ba6
movl $0x800f0000, %edi       # imm = 0x800F0000
movl $0x2f0, %ecx            # imm = 0x2F0
jmp 0x6e4f
leaq 0x2e36(%rip), %rsi      # 0x9c74
leaq 0x2d61(%rip), %rdx      # 0x9ba6
movl $0x800f0000, %edi       # imm = 0x800F0000
movl $0x2fa, %ecx            # imm = 0x2FA
callq 0x3138
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2e08(%rip), %rsi      # 0x9c74
leaq 0x2d33(%rip), %rdx      # 0x9ba6
movl $0x800d0000, %edi       # imm = 0x800D0000
movl $0x306, %ecx            # imm = 0x306
callq 0x3138
jmp 0x6e56