// File: /workspace/github_c_makefile_star2_O2/aremmell[P]libsir/src/sirplugins.c
// Function: sir_plugin_cache_dispatch
bool _sir_plugin_cache_dispatch(const sir_plugincache* spc, sir_level level, sirbuf* buf,
    size_t* dispatched, size_t* wanted) {
#if !defined(SIR_NO_PLUGINS)
    if (!_sir_validptr(spc) || !_sir_validlevel(level) || !_sir_validptr(buf) ||
        !_sir_validptr(dispatched) || !_sir_validptr(wanted))
        return false;

    const char* wrote    = NULL;
    sir_options lastopts = 0;

    *dispatched = 0;
    *wanted     = 0;

    for (size_t n = 0; n < spc->count; n++) {
        if (!_sir_bittest(spc->plugins[n]->info.levels, level)) {
            _sir_selflog("level %04"PRIx16" not set in level mask (%04"PRIx16
                         ") for plugin (path: '%s', id: %08"PRIx32"); skipping",
                         level, spc->plugins[n]->info.levels, spc->plugins[n]->path,
                         spc->plugins[n]->id);
            continue;
        }

        (*wanted)++;

        if (!wrote || spc->plugins[n]->info.opts != lastopts) {
            wrote = _sir_format(false, spc->plugins[n]->info.opts, buf);
            SIR_ASSERT(wrote);
            lastopts = spc->plugins[n]->info.opts;
        }

        if (wrote && spc->plugins[n]->iface.write(level, wrote)) {
            (*dispatched)++;
        } else {
            _sir_selflog("error: write to plugin (path: '%s', id: %08"PRIx32")"
                         " failed!", spc->plugins[n]->path, spc->plugins[n]->id);
        }
    }

    return (*dispatched == *wanted);
#else
    SIR_UNUSED(spc);
    SIR_UNUSED(level);
    SIR_UNUSED(buf);
    SIR_UNUSED(dispatched);
    SIR_UNUSED(wanted);
    return false;
#endif
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %rbx
movq %rcx, %r15
movq %rdx, %r13
movl %esi, %ebp
movq %rdi, %r12
leaq 0x2232(%rip), %rdx      # 0x9f4f
pushq $0x1
popq %rsi
movl $0x1ca, %ecx            # imm = 0x1CA
callq 0x796e
testb %al, %al
je 0x7e36
movzwl %bp, %r14d
leaq 0x2212(%rip), %rsi      # 0x9f4f
leaq 0x20ed(%rip), %rdx      # 0x9e31
movl %r14d, %edi
movl $0x1ca, %ecx            # imm = 0x1CA
callq 0x532b
testb %al, %al
je 0x7e36
leaq 0x21ef(%rip), %rdx      # 0x9f4f
pushq $0x1
popq %rsi
movq %r13, %rdi
movl $0x1ca, %ecx            # imm = 0x1CA
callq 0x796e
testb %al, %al
je 0x7e36
leaq 0x21d0(%rip), %rdx      # 0x9f4f
pushq $0x1
popq %rsi
movq %r15, %rdi
movl $0x1cb, %ecx            # imm = 0x1CB
callq 0x796e
testb %al, %al
je 0x7e36
movl %r14d, 0x4(%rsp)
leaq 0x21ac(%rip), %rdx      # 0x9f4f
pushq $0x1
popq %rsi
movq %rbx, %rdi
movl $0x1cb, %ecx            # imm = 0x1CB
callq 0x796e
xorl %r14d, %r14d
testb %al, %al
je 0x7e39
movq %r13, 0x10(%rsp)
movq %r15, 0x8(%rsp)
andq $0x0, (%r15)
andq $0x0, (%rbx)
xorl %r15d, %r15d
xorl %r13d, %r13d
cmpq 0x80(%r12), %r13
jae 0x7e4b
movq (%r12,%r13,8), %rax
movl 0x14(%rax), %ecx
notl %ecx
testw %cx, %bp
jne 0x7e31
incq (%rbx)
movl 0x18(%rax), %esi
testq %r15, %r15
je 0x7dfa
cmpl %r14d, %esi
je 0x7e16
xorl %edi, %edi
movq 0x10(%rsp), %rdx
callq 0x6e84
movq %rax, %r15
movq (%r12,%r13,8), %rax
movl 0x18(%rax), %r14d
testq %r15, %r15
je 0x7e2e
movl 0x4(%rsp), %edi
movq %r15, %rsi
callq *0x50(%rax)
testb %al, %al
je 0x7e31
movq 0x8(%rsp), %rax
incq (%rax)
jmp 0x7e31
xorl %r15d, %r15d
incq %r13
jmp 0x7dd2
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rsp), %rax
movq (%rax), %rax
cmpq (%rbx), %rax
sete %r14b
jmp 0x7e39