// File: /workspace/github_c_makefile_star2_O0/excess-c64[P]lib1541img/src/lib/1541img/zcfileset.c
// Function: fromVfsInternal
static ZcFileSet *fromVfsInternal(const CbmdosVfs *vfs, int logerrors)
{
    logfmt(L_INFO, "ZcFileSet: checking disk `%s,%s'", CbmdosVfs_name(vfs, 0),
            CbmdosVfs_id(vfs, 0));

    const char *compare = 0;
    FileData *files[5] = { 0 };
    for (unsigned pos = 0; pos < CbmdosVfs_fileCount(vfs); ++pos)
    {
        const CbmdosFile *dosfile = CbmdosVfs_rfile(vfs, pos);
        if (CbmdosFile_type(dosfile) != CFT_PRG) continue;
        uint8_t namelen;
        const char *name = CbmdosFile_name(dosfile, &namelen);
        if (namelen < 3) continue;
        if (name[1] != '!' || name[2] == '!') continue;
        if (name[0] < '1' || name[0] > '5') continue;
        if (compare)
        {
            if (strcmp(name+2, compare)) continue;
        }
        else compare = name+2;
        int partidx = name[0] - '1';
        if (files[partidx])
        {
            logfmt(logerrors ? L_WARNING : L_INFO,
                    "ZcFileSet: skipping duplicate `%s.PRG'", name);
            continue;
        }
        files[partidx] = FileData_clone(CbmdosFile_rdata(dosfile));
        logfmt(L_INFO, "ZcFileSet: found `%s.PRG' (%lu bytes)", name,
                (unsigned long)FileData_size(files[partidx]));
    }

    return fromFileData(compare, files, logerrors);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x51a0
movq %rax, -0x70(%rbp)
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x5420
movq -0x70(%rbp), %rdx
movq %rax, %rcx
movl $0x3, %edi
leaq 0xbf92(%rip), %rsi      # 0x13765
movb $0x0, %al
callq 0x5ab0
movq $0x0, -0x18(%rbp)
leaq -0x40(%rbp), %rdi
xorl %esi, %esi
movl $0x28, %edx
callq 0x5340
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x74(%rbp)
movq -0x8(%rbp), %rdi
callq 0x5260
movl %eax, %ecx
movl -0x74(%rbp), %eax
cmpl %ecx, %eax
jae 0x795e
movq -0x8(%rbp), %rdi
movl -0x44(%rbp), %esi
callq 0x5360
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
callq 0x57f0
cmpl $0x2, %eax
je 0x7838
jmp 0x7950
movq -0x50(%rbp), %rdi
leaq -0x51(%rbp), %rsi
callq 0x5380
movq %rax, -0x60(%rbp)
movzbl -0x51(%rbp), %eax
cmpl $0x3, %eax
jge 0x7857
jmp 0x7950
movq -0x60(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x21, %eax
jne 0x7871
movq -0x60(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x21, %eax
jne 0x7876
jmp 0x7950
movq -0x60(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x31, %eax
jl 0x788e
movq -0x60(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x35, %eax
jle 0x7893
jmp 0x7950
cmpq $0x0, -0x18(%rbp)
je 0x78b7
movq -0x60(%rbp), %rdi
addq $0x2, %rdi
movq -0x18(%rbp), %rsi
callq 0x5450
cmpl $0x0, %eax
je 0x78b5
jmp 0x7950
jmp 0x78c3
movq -0x60(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x18(%rbp)
movq -0x60(%rbp), %rax
movsbl (%rax), %eax
subl $0x31, %eax
movl %eax, -0x64(%rbp)
movslq -0x64(%rbp), %rax
cmpq $0x0, -0x40(%rbp,%rax,8)
je 0x7903
movl -0xc(%rbp), %ecx
movl $0x3, %edi
movl $0x2, %eax
cmpl $0x0, %ecx
cmovnel %eax, %edi
movq -0x60(%rbp), %rdx
leaq 0xbe8c(%rip), %rsi      # 0x13786
movb $0x0, %al
callq 0x5ab0
jmp 0x7950
movq -0x50(%rbp), %rdi
callq 0x5190
movq %rax, %rdi
callq 0x5160
movq %rax, %rcx
movslq -0x64(%rbp), %rax
movq %rcx, -0x40(%rbp,%rax,8)
movq -0x60(%rbp), %rax
movq %rax, -0x80(%rbp)
movslq -0x64(%rbp), %rax
movq -0x40(%rbp,%rax,8), %rdi
callq 0x5550
movq -0x80(%rbp), %rdx
movq %rax, %rcx
movl $0x3, %edi
leaq 0xbe64(%rip), %rsi      # 0x137ad
movb $0x0, %al
callq 0x5ab0
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x77f9
movq -0x18(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movl -0xc(%rbp), %edx
callq 0x7ca0
addq $0x80, %rsp
popq %rbp
retq
nopw (%rax,%rax)