// File: /workspace/github_c_makefile_star2_O1/aremmell[P]libsir/src/sirfilecache.c
// Function: sir_fcache_dispatch
bool _sir_fcache_dispatch(const sirfcache* sfc, sir_level level, sirbuf* buf,
    size_t* dispatched, size_t* wanted) {
    bool retval = _sir_validptr(sfc) && _sir_validlevel(level) &&
                  _sir_validptr(buf) && _sir_validptr(dispatched) &&
                  _sir_validptr(wanted);

    if (retval) {
        const char* wrote    = NULL;
        sir_options lastopts = 0U;

        *dispatched = 0;
        *wanted     = 0;

        for (size_t n = 0; n < sfc->count; n++) {
            SIR_ASSERT(_sirfile_validate(sfc->files[n]));

            if (!_sir_bittest(sfc->files[n]->levels, level)) {
                _sir_selflog("level %04"PRIx16" not set in level mask (%04"PRIx16
                            ") for file (path: '%s', id: %"PRIx32"); skipping",
                            level, sfc->files[n]->levels, sfc->files[n]->path,
                            sfc->files[n]->id);
                continue;
            }

            (*wanted)++;

            if (!wrote || sfc->files[n]->opts != lastopts) {
                wrote = _sir_format(false, sfc->files[n]->opts, buf);
                SIR_ASSERT(wrote);
                lastopts = sfc->files[n]->opts;
            }

            if (wrote && _sirfile_write(sfc->files[n], wrote)) {
                (*dispatched)++;
            } else {
                _sir_selflog("error: write to file (path: '%s', id: %"PRIx32") failed!",
                    sfc->files[n]->path, sfc->files[n]->id);
            }
        }

        retval = (*dispatched == *wanted);
    }

    return retval;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %rbx
movq %rcx, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
movl %esi, %ebp
movq %rdi, %r12
testq %rdi, %rdi
je 0x4bc2
movzwl %bp, %edi
leaq 0x4e17(%rip), %rsi      # 0x99a7
leaq 0x4c77(%rip), %rdx      # 0x980e
movl $0x257, %ecx            # imm = 0x257
callq 0x56f7
testb %al, %al
je 0x4be4
cmpq $0x0, 0x10(%rsp)
sete %al
cmpq $0x0, 0x8(%rsp)
sete %cl
orb %al, %cl
je 0x4be9
movl $0x258, %ecx            # imm = 0x258
jmp 0x4bc7
movl $0x257, %ecx            # imm = 0x257
xorl %r13d, %r13d
leaq 0x4dd6(%rip), %rsi      # 0x99a7
leaq 0x4c36(%rip), %rdx      # 0x980e
movl $0x800b0000, %edi       # imm = 0x800B0000
callq 0x31c0
jmp 0x4bf6
xorl %r13d, %r13d
jmp 0x4bf6
testq %rbx, %rbx
setne %r13b
je 0x4c9e
testb %r13b, %r13b
je 0x4c8c
xorl %r15d, %r15d
movq 0x8(%rsp), %rax
movq %r15, (%rax)
movq %r15, (%rbx)
cmpq %r15, 0x80(%r12)
je 0x4c7d
xorl %r14d, %r14d
xorl %r13d, %r13d
movq (%r12,%r14,8), %rax
movl 0x8(%rax), %ecx
notl %ecx
testw %cx, %bp
jne 0x4c70
incq (%rbx)
testq %r13, %r13
je 0x4c39
cmpl %r15d, 0xc(%rax)
je 0x4c53
movl 0xc(%rax), %esi
xorl %edi, %edi
movq 0x10(%rsp), %rdx
callq 0x7432
movq %rax, %r13
movq (%r12,%r14,8), %rax
movl 0xc(%rax), %r15d
testq %r13, %r13
je 0x4c70
movq (%r12,%r14,8), %rdi
movq %r13, %rsi
callq 0x3eb3
testb %al, %al
je 0x4c70
movq 0x8(%rsp), %rax
incq (%rax)
incq %r14
cmpq 0x80(%r12), %r14
jb 0x4c1d
movq 0x8(%rsp), %rax
movq (%rax), %rax
cmpq (%rbx), %rax
sete %r13b
movl %r13d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x259, %ecx            # imm = 0x259
jmp 0x4bca