// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x48, %rsp
movw %si, %ax
movq %rdi, 0x38(%rsp)
movw %ax, 0x36(%rsp)
movq %rdx, 0x28(%rsp)
movq %rcx, 0x20(%rsp)
movq %r8, 0x18(%rsp)
movq 0x38(%rsp), %rdi
movl $0x1, %esi
leaq 0x3d98(%rip), %rdx      # 0x11f39
leaq 0x3778(%rip), %rcx      # 0x11920
movl $0x1ca, %r8d            # imm = 0x1CA
callq 0xd900
testb $0x1, %al
jne 0xe1bc
jmp 0xe258
leaq 0x3d76(%rip), %rsi      # 0x11f39
leaq 0x3756(%rip), %rdx      # 0x11920
movl $0x1ca, %ecx            # imm = 0x1CA
movzwl 0x36(%rsp), %edi
callq 0x8080
testb $0x1, %al
jne 0xe1df
jmp 0xe258
movq 0x28(%rsp), %rdi
movl $0x1, %esi
leaq 0x3d49(%rip), %rdx      # 0x11f39
leaq 0x3729(%rip), %rcx      # 0x11920
movl $0x1ca, %r8d            # imm = 0x1CA
callq 0xd900
testb $0x1, %al
jne 0xe208
jmp 0xe258
movq 0x20(%rsp), %rdi
movl $0x1, %esi
leaq 0x3d20(%rip), %rdx      # 0x11f39
leaq 0x3700(%rip), %rcx      # 0x11920
movl $0x1cb, %r8d            # imm = 0x1CB
callq 0xd900
testb $0x1, %al
jne 0xe231
jmp 0xe258
movq 0x18(%rsp), %rdi
movl $0x1, %esi
leaq 0x3cf7(%rip), %rdx      # 0x11f39
leaq 0x36d7(%rip), %rcx      # 0x11920
movl $0x1cb, %r8d            # imm = 0x1CB
callq 0xd900
testb $0x1, %al
jne 0xe262
movb $0x0, 0x47(%rsp)
jmp 0xe40d
movq $0x0, 0x10(%rsp)
movl $0x0, 0xc(%rsp)
movq 0x20(%rsp), %rax
movq $0x0, (%rax)
movq 0x18(%rsp), %rax
movq $0x0, (%rax)
movq $0x0, (%rsp)
movq (%rsp), %rax
movq 0x38(%rsp), %rcx
cmpq 0x80(%rcx), %rax
jae 0xe3f4
movq 0x38(%rsp), %rax
movq (%rsp), %rcx
movq (%rax,%rcx,8), %rax
movzwl 0x14(%rax), %edi
movzwl 0x36(%rsp), %esi
callq 0xe420
testb $0x1, %al
jne 0xe312
movzwl 0x36(%rsp), %esi
movq 0x38(%rsp), %rax
movq (%rsp), %rcx
movq (%rax,%rcx,8), %rax
movzwl 0x14(%rax), %edx
movq 0x38(%rsp), %rax
movq (%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rcx
movq 0x38(%rsp), %rax
movq (%rsp), %rdi
movq (%rax,%rdi,8), %rax
movl 0x60(%rax), %r8d
leaq 0x3c4e(%rip), %rdi      # 0x11f54
movb $0x0, %al
callq 0xd060
jmp 0xe3e3
movq 0x18(%rsp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
cmpq $0x0, 0x10(%rsp)
je 0xe33f
movq 0x38(%rsp), %rax
movq (%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x18(%rax), %eax
cmpl 0xc(%rsp), %eax
je 0xe374
movq 0x38(%rsp), %rax
movq (%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x18(%rax), %esi
movq 0x28(%rsp), %rdx
xorl %edi, %edi
callq 0xbf50
movq %rax, 0x10(%rsp)
movq 0x38(%rsp), %rax
movq (%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x18(%rax), %eax
movl %eax, 0xc(%rsp)
cmpq $0x0, 0x10(%rsp)
je 0xe3b3
movq 0x38(%rsp), %rax
movq (%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x50(%rax), %rax
movw 0x36(%rsp), %cx
movq 0x10(%rsp), %rsi
movzwl %cx, %edi
callq *%rax
testb $0x1, %al
jne 0xe3a2
jmp 0xe3b3
movq 0x20(%rsp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
jmp 0xe3e1
movq 0x38(%rsp), %rax
movq (%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rsi
movq 0x38(%rsp), %rax
movq (%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x60(%rax), %edx
leaq 0x3bce(%rip), %rdi      # 0x11fa8
movb $0x0, %al
callq 0xd060
jmp 0xe3e3
movq (%rsp), %rax
addq $0x1, %rax
movq %rax, (%rsp)
jmp 0xe293
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq 0x18(%rsp), %rcx
cmpq (%rcx), %rax
sete %al
andb $0x1, %al
movb %al, 0x47(%rsp)
movb 0x47(%rsp), %al
andb $0x1, %al
addq $0x48, %rsp
retq
nopl (%rax,%rax)