// File: /workspace/github_c_makefile_star2_O1/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, %r13
movl %esi, %r15d
movq %rdi, %r14
movl (%rdi), %eax
notl %eax
testl %eax, %esi
jne 0x7260
movl 0x4(%r14), %esi
movl $0x1, %edi
movq %r13, %rdx
callq 0x7432
testq %rax, %rax
je 0x7270
cmpb $0x0, (%rax)
je 0x7270
movq 0x6d87(%rip), %rcx      # 0xdfd8
movq (%rcx), %rdi
movq %rax, %rsi
callq 0x8b70
movl %eax, %ebp
jmp 0x7272
movb $0x1, %bpl
xorl %ebx, %ebx
movq $0x0, 0x8(%rsp)
jmp 0x7280
xorl %ebp, %ebp
movzbl %bpl, %eax
movq %rax, 0x8(%rsp)
movl $0x1, %ebx
movl 0x8(%r14), %eax
notl %eax
testw %ax, %r15w
jne 0x72d8
movl 0xc(%r14), %esi
movl $0x1, %edi
movq %r13, %rdx
callq 0x7432
xorl %r12d, %r12d
testq %rax, %rax
je 0x72be
cmpb $0x0, (%rax)
je 0x72be
movq 0x6d47(%rip), %rcx      # 0xdff8
movq (%rcx), %rdi
movq %rax, %rsi
callq 0x8b70
jmp 0x72c0
xorl %eax, %eax
movzbl %bpl, %ecx
testb %al, %al
cmovnel %ecx, %r12d
movzbl %al, %eax
addq %rax, 0x8(%rsp)
incq %rbx
movl %r12d, %ebp
movl 0x10(%r14), %eax
notl %eax
movzwl %r15w, %r12d
testw %ax, %r15w
jne 0x7305
addq $0x10, %r14
movl %r12d, %edi
movq %r13, %rsi
movq %r14, %rdx
callq 0x771f
movzbl %al, %eax
addq %rax, 0x8(%rsp)
incq %rbx
leaq 0x7494(%rip), %rdi      # 0xe7a0
callq 0x799c
testb %al, %al
je 0x73cb
movl %ebp, 0x14(%rsp)
xorl %eax, %eax
leaq 0x30(%rsp), %r15
movq %rax, (%r15)
movq %r13, %rbp
leaq 0x28(%rsp), %r13
movq %rax, (%r13)
leaq 0x748e(%rip), %rdi      # 0xe7c8
movl %r12d, %esi
movq %rbp, %rdx
movq %r15, %rcx
movq %r13, %r8
callq 0x4b61
movb %al, 0x7(%rsp)
leaq 0x744a(%rip), %rdi      # 0xe7a0
callq 0x7a3a
movq (%r15), %r14
movq (%r13), %r13
leaq 0x74e7(%rip), %rdi      # 0xe850
callq 0x799c
testb %al, %al
je 0x73e5
addq %rbx, %r13
xorl %eax, %eax
leaq 0x18(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x20(%rsp), %r15
movq %rax, (%r15)
leaq 0x74ea(%rip), %rdi      # 0xe878
movl %r12d, %esi
movq %rbp, %rdx
movq %r15, %r8
callq 0x832e
movl %eax, %ebx
leaq 0x74ab(%rip), %rdi      # 0xe850
callq 0x7a3a
addq (%r15), %r13
je 0x7413
addq 0x8(%rsp), %r14
addq 0x18(%rsp), %r14
andb 0x7(%rsp), %bl
andb 0x14(%rsp), %bl
cmpq %r13, %r14
sete %al
andb %bl, %al
jmp 0x7404
leaq 0x28b2(%rip), %rsi      # 0x9c84
leaq 0x27dd(%rip), %rdx      # 0x9bb6
movl $0x800f0000, %edi       # imm = 0x800F0000
movl $0x2f0, %ecx            # imm = 0x2F0
jmp 0x73fd
leaq 0x2898(%rip), %rsi      # 0x9c84
leaq 0x27c3(%rip), %rdx      # 0x9bb6
movl $0x800f0000, %edi       # imm = 0x800F0000
movl $0x2fa, %ecx            # imm = 0x2FA
callq 0x31c0
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x286a(%rip), %rsi      # 0x9c84
leaq 0x2795(%rip), %rdx      # 0x9bb6
movl $0x800d0000, %edi       # imm = 0x800D0000
movl $0x306, %ecx            # imm = 0x306
callq 0x31c0
jmp 0x7404