// File: /workspace/github_c_makefile_star2_O2/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, %r14
movq %rdx, %r15
movl %esi, %ebp
movq %rdi, %r12
leaq 0x51d7(%rip), %rdx      # 0x99a7
pushq $0x1
popq %rsi
movl $0x257, %ecx            # imm = 0x257
callq 0x3cb7
testb %al, %al
je 0x48de
movzwl %bp, %edi
leaq 0x51b8(%rip), %rsi      # 0x99a7
leaq 0x5018(%rip), %rdx      # 0x980e
movl $0x257, %ecx            # imm = 0x257
callq 0x532b
testb %al, %al
je 0x48de
leaq 0x5198(%rip), %rdx      # 0x99a7
pushq $0x1
popq %rsi
movq %r15, %rdi
movl $0x258, %ecx            # imm = 0x258
callq 0x3cb7
testb %al, %al
je 0x48de
leaq 0x5179(%rip), %rdx      # 0x99a7
pushq $0x1
popq %rsi
movq %r14, %rdi
movl $0x258, %ecx            # imm = 0x258
callq 0x3cb7
testb %al, %al
je 0x48de
leaq 0x515a(%rip), %rdx      # 0x99a7
pushq $0x1
popq %rsi
movq %rbx, %rdi
movl $0x259, %ecx            # imm = 0x259
callq 0x3cb7
xorl %r13d, %r13d
testb %al, %al
je 0x48e1
movq %r15, 0x10(%rsp)
movq %r14, 0x8(%rsp)
andq $0x0, (%r14)
andq $0x0, (%rbx)
xorl %r14d, %r14d
xorl %r15d, %r15d
cmpq 0x80(%r12), %r15
jae 0x48f3
movq (%r12,%r15,8), %rdi
movl 0x8(%rdi), %eax
notl %eax
testw %ax, %bp
jne 0x48d9
incq (%rbx)
movl 0xc(%rdi), %esi
testq %r14, %r14
je 0x48a4
cmpl %r13d, %esi
je 0x48c0
xorl %edi, %edi
movq 0x10(%rsp), %rdx
callq 0x6e84
movq (%r12,%r15,8), %rdi
movl 0xc(%rdi), %r13d
testq %rax, %rax
je 0x48d6
movq %rax, %r14
movq %r14, %rsi
callq 0x3cf8
testb %al, %al
je 0x48d9
movq 0x8(%rsp), %rax
incq (%rax)
jmp 0x48d9
xorl %r14d, %r14d
incq %r15
jmp 0x487c
xorl %r13d, %r13d
movl %r13d, %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 %r13b
jmp 0x48e1