// File: /workspace/github_c_makefile_star2_O0/excess-c64[P]lib1541img/src/lib/1541img/zcfileset.c
// Function: ZcFileSet_fromFile
SOEXPORT ZcFileSet *ZcFileSet_fromFile(const char *filename)
{
    ZcFileSet *self = 0;
    Filename *fn = Filename_create();
    Filename_setFull(fn, filename);
    char *ext = upperstr(Filename_ext(fn));
    if ((!ext || strcmp(ext, "D64"))
	    && Filename_base(fn)[1] == '!')
    {
	char *base = copystr(Filename_base(fn));
	if (base[0] >= '1' && base[0] <= '5'
		&& base[1] == '!' && base[2] != '!')
	{
            logmsg(L_INFO, "ZcFileSet: 4/5-file disk-packed zipcode "
                    "detected, looking for all member files...");
	    FileData *files[5] = { 0 };
	    for (base[0] = '1'; base[0] <= '5'; ++base[0])
	    {
		Filename *pn = Filename_clone(fn);
		Filename_setBase(pn, base);
                const char *ffn = Filename_full(pn);
                logfmt(L_INFO, "ZcFileSet: trying to read `%s'.", ffn);
		FILE *p = fopen_internal(ffn, "rb");
		if (p)
		{
		    files[base[0]-'1'] = readHostFile(p);
		    fclose(p);
		}
	    }
	    self = fromFileData(base+2, files, 1);
	}
        else
        {
            logmsg(L_WARNING, "ZcFileSet: no known ZipCode structure found.");
        }
	free(base);
    }
    else if (!strcmp(ext, "D64"))
    {
        self = fromD64(filename);
    }
    else
    {
        logmsg(L_WARNING, "ZcFileSet: no known ZipCode structure found.");
    }
    free(ext);
    return self;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
callq 0x70e0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x7240
movq -0x18(%rbp), %rdi
callq 0x7220
movq %rax, %rdi
callq 0x59c0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x7adf
movq -0x20(%rbp), %rdi
leaq 0xbb74(%rip), %rsi      # 0x13645
callq 0x5450
cmpl $0x0, %eax
je 0x7c4d
movq -0x18(%rbp), %rdi
callq 0x7200
movsbl 0x1(%rax), %eax
cmpl $0x21, %eax
jne 0x7c4d
movq -0x18(%rbp), %rdi
callq 0x7200
movq %rax, %rdi
callq 0x5960
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x31, %eax
jl 0x7c31
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x35, %eax
jg 0x7c31
movq -0x28(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x21, %eax
jne 0x7c31
movq -0x28(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x21, %eax
je 0x7c31
movl $0x3, %edi
leaq 0xbaf1(%rip), %rsi      # 0x13649
callq 0x5a60
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
movl $0x28, %edx
callq 0x5340
movq -0x28(%rbp), %rax
movb $0x31, (%rax)
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x35, %eax
jg 0x7c15
movq -0x18(%rbp), %rdi
callq 0x7110
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x75a0
movq -0x58(%rbp), %rdi
callq 0x71c0
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdx
movl $0x3, %edi
leaq 0xbae0(%rip), %rsi      # 0x1369b
movb $0x0, %al
callq 0x5ab0
movq -0x60(%rbp), %rdi
leaq 0xbaee(%rip), %rsi      # 0x136bb
callq 0x56b0
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x68(%rbp)
je 0x7c03
movq -0x68(%rbp), %rdi
callq 0x52f0
movq %rax, %rcx
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
subl $0x31, %eax
cltq
movq %rcx, -0x50(%rbp,%rax,8)
movq -0x68(%rbp), %rdi
callq 0x5240
jmp 0x7c05
movq -0x28(%rbp), %rax
movb (%rax), %cl
addb $0x1, %cl
movb %cl, (%rax)
jmp 0x7b74
movq -0x28(%rbp), %rdi
addq $0x2, %rdi
leaq -0x50(%rbp), %rsi
movl $0x1, %edx
callq 0x7ca0
movq %rax, -0x10(%rbp)
jmp 0x7c42
movl $0x2, %edi
leaq 0xba81(%rip), %rsi      # 0x136be
callq 0x5a60
movq -0x28(%rbp), %rdi
callq 0x5070
jmp 0x7c84
movq -0x20(%rbp), %rdi
leaq 0xb9ed(%rip), %rsi      # 0x13645
callq 0x5450
cmpl $0x0, %eax
jne 0x7c71
movq -0x8(%rbp), %rdi
callq 0x7e10
movq %rax, -0x10(%rbp)
jmp 0x7c82
movl $0x2, %edi
leaq 0xba41(%rip), %rsi      # 0x136be
callq 0x5a60
jmp 0x7c84
movq -0x20(%rbp), %rdi
callq 0x5070
movq -0x10(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)