// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x58, %rsp
movw %si, %ax
movq %rdi, 0x50(%rsp)
movw %ax, 0x4e(%rsp)
movq %rdx, 0x40(%rsp)
movq %rcx, 0x38(%rsp)
movq %r8, 0x30(%rsp)
movq 0x50(%rsp), %rdi
movl $0x1, %esi
leaq 0xa542(%rip), %rdx      # 0x10d43
leaq 0xa075(%rip), %rcx      # 0x1087d
movl $0x257, %r8d            # imm = 0x257
callq 0x5200
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0xf(%rsp)
jne 0x6825
jmp 0x68df
leaq 0xa517(%rip), %rsi      # 0x10d43
leaq 0xa04a(%rip), %rdx      # 0x1087d
movl $0x257, %ecx            # imm = 0x257
movzwl 0x4e(%rsp), %edi
callq 0x8080
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0xf(%rsp)
jne 0x6854
jmp 0x68df
movq 0x40(%rsp), %rdi
movl $0x1, %esi
leaq 0xa4de(%rip), %rdx      # 0x10d43
leaq 0xa011(%rip), %rcx      # 0x1087d
movl $0x258, %r8d            # imm = 0x258
callq 0x5200
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0xf(%rsp)
jne 0x6886
jmp 0x68df
movq 0x38(%rsp), %rdi
movl $0x1, %esi
leaq 0xa4ac(%rip), %rdx      # 0x10d43
leaq 0x9fdf(%rip), %rcx      # 0x1087d
movl $0x258, %r8d            # imm = 0x258
callq 0x5200
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0xf(%rsp)
jne 0x68b8
jmp 0x68df
movq 0x30(%rsp), %rdi
movl $0x1, %esi
leaq 0xa47a(%rip), %rdx      # 0x10d43
leaq 0x9fad(%rip), %rcx      # 0x1087d
movl $0x259, %r8d            # imm = 0x259
callq 0x5200
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
andb $0x1, %al
movb %al, 0x2f(%rsp)
testb $0x1, 0x2f(%rsp)
je 0x6aa4
movq $0x0, 0x20(%rsp)
movl $0x0, 0x1c(%rsp)
movq 0x38(%rsp), %rax
movq $0x0, (%rax)
movq 0x30(%rsp), %rax
movq $0x0, (%rax)
movq $0x0, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq 0x50(%rsp), %rcx
cmpq 0x80(%rcx), %rax
jae 0x6a8b
movq 0x50(%rsp), %rax
movq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movzwl 0x8(%rax), %edi
movzwl 0x4e(%rsp), %esi
callq 0x62c0
testb $0x1, %al
jne 0x69aa
movzwl 0x4e(%rsp), %esi
movq 0x50(%rsp), %rax
movq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movzwl 0x8(%rax), %edx
movq 0x50(%rsp), %rax
movq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rcx
movq 0x50(%rsp), %rax
movq 0x10(%rsp), %rdi
movq (%rax,%rdi,8), %rax
movl 0x18(%rax), %r8d
leaq 0xa3ba(%rip), %rdi      # 0x10d58
movb $0x0, %al
callq 0x5ff0
jmp 0x6a78
movq 0x30(%rsp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
cmpq $0x0, 0x20(%rsp)
je 0x69d8
movq 0x50(%rsp), %rax
movq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl 0xc(%rax), %eax
cmpl 0x1c(%rsp), %eax
je 0x6a0f
movq 0x50(%rsp), %rax
movq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl 0xc(%rax), %esi
movq 0x40(%rsp), %rdx
xorl %edi, %edi
callq 0xbf50
movq %rax, 0x20(%rsp)
movq 0x50(%rsp), %rax
movq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl 0xc(%rax), %eax
movl %eax, 0x1c(%rsp)
cmpq $0x0, 0x20(%rsp)
je 0x6a46
movq 0x50(%rsp), %rax
movq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x20(%rsp), %rsi
callq 0x5320
testb $0x1, %al
jne 0x6a35
jmp 0x6a46
movq 0x38(%rsp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
jmp 0x6a76
movq 0x50(%rsp), %rax
movq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rsi
movq 0x50(%rsp), %rax
movq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x18(%rax), %edx
leaq 0xa339(%rip), %rdi      # 0x10da8
movb $0x0, %al
callq 0x5ff0
jmp 0x6a78
movq 0x10(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x10(%rsp)
jmp 0x6926
movq 0x38(%rsp), %rax
movq (%rax), %rax
movq 0x30(%rsp), %rcx
cmpq (%rcx), %rax
sete %al
andb $0x1, %al
movb %al, 0x2f(%rsp)
movb 0x2f(%rsp), %al
andb $0x1, %al
addq $0x58, %rsp
retq
nop