// File: /workspace/github_c_makefile_star2_O3/excess-c64[P]lib1541img/src/lib/1541img/cbmdosvfsreader.c
// Function: readCbmdosVfsInternal
SOLOCAL int readCbmdosVfsInternal(CbmdosVfs *vfs, const D64 *d64,
	const CbmdosFsOptions *options,
	uint8_t (*bamdata)[21], DirData *dirdata)
{
    if (CbmdosVfs_fileCount(vfs))
    {
        logmsg(L_ERROR, "readCbmdosVfs: called with non-empty vfs.");
        return -1;
    }

    const uint8_t *bam = Sector_rcontent(D64_rsector(d64, 18, 0));
    CbmdosVfs_setDosver(vfs, bam[2]);
    uint8_t nameoffset = 0;
    if (options->flags & CFF_PROLOGICDOSBAM) nameoffset = 0x14;
    uint8_t namelen = 16;
    while (namelen && bam[namelen + 0x8f + nameoffset] == 0xa0) --namelen;
    CbmdosVfs_setName(vfs, (const char *)bam+0x90+nameoffset, namelen);
    uint8_t idlen = 5;
    if (bam[0xa6+nameoffset] == bam[2])
    {
	--idlen;
	if (bam[0xa5+nameoffset] == 0x32)
	{
	    --idlen;
	    if (bam[0xa4+nameoffset] == 0xa0)
            {
                --idlen;
                if (bam[0xa3+nameoffset] == 0xa0)
                {
                    --idlen;
                    if (bam[0xa2+nameoffset] == 0xa0) --idlen;
                }
            }
	}
    }
    CbmdosVfs_setId(vfs, (const char *)bam+0xa2+nameoffset, idlen);

    int rc = 0;
    if (bamdata)
    {
	for (uint8_t trackno = 1; trackno <= D64_tracks(d64); ++trackno)
	{
	    uint8_t sectors = Track_sectors(D64_rtrack(d64, trackno));
	    if (trackno < 36)
	    {
		if (parseTrackBam(bamdata[trackno-1], sectors,
			    bam + 4*trackno) < 0)
		{
		    if (!(options->flags & CFF_ZEROFREE)) rc = -2;
		}
	    }
	    else if ((options->flags & (CFF_40TRACK | CFF_42TRACK))
		    && (trackno < 41))
	    {
		if (options->flags & CFF_DOLPHINDOSBAM)
		{
		    if (parseTrackBam(bamdata[trackno-1], sectors,
				bam + 0x1c + 4*trackno) < 0)
		    {
			if (!(options->flags & CFF_ZEROFREE)) rc = -2;
		    }
		}
		if (options->flags & CFF_SPEEDDOSBAM)
		{
		    if (parseTrackBam(bamdata[trackno-1], sectors,
				bam + 0x30 + 4*trackno) < 0)
		    {
			if (!(options->flags & CFF_ZEROFREE)) rc = -2;
		    }
		}
		if (options->flags & CFF_PROLOGICDOSBAM)
		{
		    if (parseTrackBam(bamdata[trackno-1], sectors,
				bam + 4*trackno) < 0)
		    {
			if (!(options->flags & CFF_ZEROFREE)) rc = -2;
		    }
		}
	    }
	}
    }

    uint8_t maxtrack = 35;
    if (options->flags & CFF_40TRACK) maxtrack = 40;
    if (options->flags & CFF_42TRACK) maxtrack = 42;

    const Sector *dirsect = D64_rsector(d64, 18, 1);

    uint8_t rdmap[42][21] = { { 0 } };
    rdmap[17][0] = 1;
    rdmap[17][1] = 1;

    while (dirsect)
    {
        const uint8_t *dirbytes = Sector_rcontent(dirsect);
        for (uint8_t dirpos = 0; dirpos < 8; ++dirpos)
        {
            const uint8_t *direntry = dirbytes + dirpos * 0x20;
            if (direntry[2])
            {
                CbmdosFileType type = direntry[2] & 0xf;
		int typeInvalid = 0;
                int locked = !!(direntry[2] & (1<<6));
                int closed = !!(direntry[2] & (1<<7));
                CbmdosFile *file = CbmdosFile_create();
                if (CbmdosFile_setType(file, type) < 0)
                {
		    if (options->flags & CFF_RECOVER)
		    {
			typeInvalid = 1;
		    }
		    else
		    {
			CbmdosFile_destroy(file);
			continue;
		    }
                }
                CbmdosFile_setLocked(file, locked);
                CbmdosFile_setClosed(file, closed);
                if (type == CFT_REL)
                {
                    if (CbmdosFile_setRecordLength(file, direntry[0x17]) < 0)
                    {
                        CbmdosFile_destroy(file);
                        continue;
                    }
                }
                uint8_t filenamelen = 16;
                while (filenamelen && direntry[filenamelen + 4] == 0xa0)
                    --filenamelen;
                CbmdosFile_setName(file, (const char *)direntry+5, filenamelen);
                logfmt(L_DEBUG, "readCbmdosVfs: found file \"%s\" %s",
                        CbmdosFile_name(file, 0),
			CbmdosFileType_name(CbmdosFile_type(file)));

		uint16_t blocks = (direntry[0x1f] << 8) | direntry[0x1e];
		if (dirdata)
		{
		    if (dirdata->size == dirdata->capa)
		    {
			dirdata->capa += DIRCHUNK;
			dirdata->entries = xrealloc(dirdata->entries,
				dirdata->capa * sizeof *dirdata->entries);
		    }
                    if (!typeInvalid && type == CFT_DEL)
                    {
		        dirdata->entries[dirdata->size].starttrack = 0;
		        dirdata->entries[dirdata->size].startsector = 0;
                    }
                    else
                    {
		        dirdata->entries[dirdata->size].starttrack
                            = direntry[3];
		        dirdata->entries[dirdata->size].startsector
                            = direntry[4];
                    }
		    dirdata->entries[dirdata->size].blocks = blocks;
                    if (type == CFT_REL)
                    {
                        dirdata->entries[dirdata->size].sidetrack
                            = direntry[0x15];
                        dirdata->entries[dirdata->size].sidesector
                            = direntry[0x16];
                    }
                    else
                    {
                        dirdata->entries[dirdata->size].sidetrack = 0;
                        dirdata->entries[dirdata->size].sidesector = 0;
                    }
		    ++dirdata->size;
		}

		if (typeInvalid || type != CFT_DEL)
		{
		    FileData *data = CbmdosFile_data(file);
		    uint8_t track = direntry[3];
		    uint8_t sector = direntry[4];
                    if (track == 18 && (sector == 0 || sector == 1))
                    {
                        track = 0;
                    }
                    int doingsidesects = 0;
		    while (track)
		    {
			if (track > maxtrack)
			{
			    logfmt(L_ERROR, "readCbmdosVfs: invalid track "
				    "%d found.", track);
			    if (options->flags & CFF_RECOVER) goto nextfile;
			    CbmdosFile_destroy(file);
			    file = 0;
			    dirsect = 0;
			    rc = -1;
			    break;
			}
			if (!(options->flags & CFF_FILESONDIRTRACK)
				&& track == 18)
			{
			    logmsg(L_ERROR, "readCbmdosVfs: unexpectedly "
				    "found file on directory track.");
			    if (!(options->flags & CFF_RECOVER))
			    {
				CbmdosFile_destroy(file);
				file = 0;
				dirsect = 0;
				rc = -1;
				break;
			    }
			}
			const Sector *filesector = D64_rsector(
				d64, track, sector);
			if (!filesector)
			{
			    logmsg(L_ERROR,
				    "readCbmdosVfs: corrupt filesystem.");
			    if (options->flags & CFF_RECOVER) goto nextfile;
			    CbmdosFile_destroy(file);
			    file = 0;
                            dirsect = 0;
			    rc = -1;
			    break;
			}
                        if (rdmap[track-1][sector])
                        {
                            logmsg(L_ERROR,
                                    "readCbmdosVfs: corrupt filesystem.");
			    if (options->flags & CFF_RECOVER) goto nextfile;
			    CbmdosFile_destroy(file);
			    file = 0;
                            dirsect = 0;
			    rc = -1;
                            break;
                        }
                        rdmap[track-1][sector] = 1;
			if (track > 40 && bamdata)
			{
			    bamdata[track-1][sector] = 1;
			}
			const uint8_t *sectorbytes = Sector_rcontent(
				D64_rsector(d64, track, sector));
			track = sectorbytes[0];
			sector = sectorbytes[1];
                        if (!doingsidesects)
                        {
                            size_t appendsize = 254;
                            if (!track) appendsize = sector-1;
                            if (FileData_append(data, sectorbytes+2,
                                        appendsize) < 0)
                            {
                                logmsg(L_ERROR, "readCbmdosVfs: error "
                                        "appending to file.");
                                CbmdosFile_destroy(file);
                                file = 0;
                                dirsect = 0;
                                rc = -1;
                                break;
                            }
                            if (!track && type == CFT_REL)
                            {
                                doingsidesects = 1;
                                track = direntry[0x15];
                                sector = direntry[0x16];
                            }
                        }
		    }
		}
nextfile:	if (file)
                {
		    if (CbmdosFile_realBlocks(file) != blocks)
		    {
			CbmdosFile_setForcedBlocks(file, blocks);
		    }
                    CbmdosVfs_append(vfs, file);
                }
		else if (dirdata)
		{
		    --dirdata->size;
		}
            }
        }
        if (dirsect && dirbytes[0])
        {
            dirsect = D64_rsector(d64, dirbytes[0], dirbytes[1]);
            if (!dirsect)
            {
                logmsg(L_ERROR, "readCbmdosVfs: corrupt filesystem.");
		if (options->flags & CFF_RECOVER) goto done;
		rc = -1;
            }
	    else if (rdmap[dirbytes[0]-1][dirbytes[1]])
            {
                logmsg(L_ERROR, "readCbmdosVfs: corrupt filesystem.");
		if (!(options->flags & CFF_RECOVER))
		{
		    rc = -1;
		    dirsect = 0;
		}
            }
	    else if (!(options->flags & CFF_ALLOWLONGDIR) && dirbytes[0] != 18)
	    {
		logmsg(L_ERROR, "readCbmdosVfs: unexpectedly found long "
			"directory.");
		if (options->flags & CFF_RECOVER) goto done;
		rc = -1;
		dirsect = 0;
	    }
	    else if (dirbytes[0] > maxtrack)
	    {
		logfmt(L_ERROR, "readCbmdosVfs: invalid track %d found.",
			dirbytes[0]);
		if (options->flags & CFF_RECOVER) goto done;
		rc = -1;
		dirsect = 0;
	    }
	    if (rc == 0)
	    {
		rdmap[dirbytes[0]-1][dirbytes[1]] = 1;
		if (dirbytes[0] > 40 && bamdata)
		{
		    bamdata[dirbytes[0]-1][dirbytes[1]] = 1;
		}
	    }
        }
        else dirsect = 0;
    }

done:
    if (rc == 0 && bamdata)
    {
	for (uint8_t track = 0; track < maxtrack; ++track)
	    for (uint8_t sect = 0; sect < 21; ++sect)
		if (bamdata[track][sect] != rdmap[track][sect])
		    return -2;
    }

    return rc;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3e8, %rsp            # imm = 0x3E8
movq %r8, %r13
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %rbp
movq %rdi, %r14
callq 0x5240
testl %eax, %eax
je 0x8134
leaq 0x6b50(%rip), %rsi      # 0xec70
movl $0x1, %edi
callq 0x591c
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x89b4
movq %rbx, 0x18(%rsp)
xorl %r15d, %r15d
movq %rbp, %rdi
movl $0x12, %esi
xorl %edx, %edx
callq 0x50c0
movq %rax, %rdi
callq 0x5670
movq %rax, %rbx
movzbl 0x2(%rax), %esi
movq %r14, 0x60(%rsp)
movq %r14, %rdi
callq 0x5600
testb $0x40, (%r12)
movl $0x14, %r14d
cmoveq %r15, %r14
leaq (%rbx,%r14), %rcx
addq $0x8f, %rcx
movb $0x10, %al
movzbl %al, %edx
cmpb $-0x60, (%rcx,%rdx)
jne 0x8192
decb %al
jne 0x8183
xorl %eax, %eax
movq %r12, 0x10(%rsp)
leaq (%rbx,%r14), %rsi
addq $0x90, %rsi
movzbl %al, %edx
movq 0x60(%rsp), %r15
movq %r15, %rdi
callq 0x5510
movb 0xa6(%rbx,%r14), %cl
movb $0x5, %al
cmpb 0x2(%rbx), %cl
jne 0x81f5
movb $0x4, %al
cmpb $0x32, 0xa5(%rbx,%r14)
jne 0x81f5
movb $0x3, %al
cmpb $-0x60, 0xa4(%rbx,%r14)
jne 0x81f5
movl %r14d, %ecx
movb $0x2, %al
cmpb $-0x60, 0xa3(%rbx,%rcx)
jne 0x81f5
cmpb $-0x60, 0xa2(%rbx,%rcx)
setne %al
leaq (%rbx,%r14), %rsi
addq $0xa2, %rsi
movzbl %al, %edx
movq %r15, %rdi
callq 0x5530
movl $0x0, 0xc(%rsp)
cmpq $0x0, 0x18(%rsp)
movq %r13, 0x50(%rsp)
movq %rbp, 0x48(%rsp)
je 0x83a6
movq %rbp, %rdi
callq 0x55f0
testb %al, %al
je 0x83a6
movq 0x18(%rsp), %rax
addq $-0x15, %rax
movq %rax, 0x28(%rsp)
leaq 0x1c(%rbx), %rax
movq %rax, 0x20(%rsp)
leaq 0x30(%rbx), %rax
movq %rax, 0x38(%rsp)
movb $0x1, %r12b
movl $0x0, 0xc(%rsp)
movl $0x1, %r15d
movzbl %r12b, %r14d
movq %rbp, %rdi
movl %r14d, %esi
callq 0x5060
movq %rax, %rdi
callq 0x5740
cmpb $0x23, %r14b
ja 0x82c8
leaq (%r14,%r14,4), %rcx
leaq (%r14,%rcx,4), %rdi
addq 0x28(%rsp), %rdi
movl %r15d, %ecx
leaq (%rbx,%rcx,4), %rdx
movzbl %al, %esi
callq 0x89c6
testl %eax, %eax
jns 0x836f
movq 0x10(%rsp), %rax
testb $-0x80, (%rax)
movl 0xc(%rsp), %eax
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
cmovel %ecx, %eax
movl %eax, 0xc(%rsp)
jmp 0x836f
movq 0x10(%rsp), %rcx
movl (%rcx), %ecx
testb $0xc, %cl
sete %dl
cmpb $0x29, %r12b
setae %sil
orb %dl, %sil
jne 0x836f
movl %r15d, %r13d
movzbl %al, %ebp
testb $0x10, %cl
je 0x832b
leaq (%r14,%r14,4), %rax
leaq (%r14,%rax,4), %rdi
addq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rax
leaq (%rax,%r13,4), %rdx
movl %ebp, %esi
callq 0x89c6
movq 0x10(%rsp), %rcx
movl (%rcx), %ecx
testl %eax, %eax
jns 0x832b
testb %cl, %cl
movl 0xc(%rsp), %eax
movl $0xfffffffe, %edx       # imm = 0xFFFFFFFE
cmovnsl %edx, %eax
movl %eax, 0xc(%rsp)
testb $0x20, %cl
je 0x836a
leaq (%r14,%r14,4), %rax
leaq (%r14,%rax,4), %rdi
addq 0x28(%rsp), %rdi
movq 0x38(%rsp), %rax
leaq (%rax,%r13,4), %rdx
movl %ebp, %esi
callq 0x89c6
movq 0x10(%rsp), %rcx
movl (%rcx), %ecx
testl %eax, %eax
jns 0x836a
testb %cl, %cl
movl 0xc(%rsp), %eax
movl $0xfffffffe, %edx       # imm = 0xFFFFFFFE
cmovnsl %edx, %eax
movl %eax, 0xc(%rsp)
testb $0x40, %cl
jne 0x838e
incb %r12b
movzbl %r12b, %r15d
movq 0x48(%rsp), %rbp
movq %rbp, %rdi
callq 0x55f0
cmpb %al, %r15b
jbe 0x826a
jmp 0x83a6
leaq (%r14,%r14,4), %rax
leaq (%r14,%rax,4), %rdi
addq 0x28(%rsp), %rdi
leaq (%rbx,%r13,4), %rdx
movl %ebp, %esi
jmp 0x829e
movq 0x10(%rsp), %rax
movl (%rax), %eax
xorl %ecx, %ecx
testb $0x4, %al
setne %cl
leal (%rcx,%rcx,4), %ecx
addl $0x23, %ecx
testb $0x8, %al
movl $0x2a, %eax
cmovel %ecx, %eax
movl %eax, 0x38(%rsp)
movq %rbp, %rdi
movl $0x12, %esi
movl $0x1, %edx
callq 0x50c0
movq %rax, %r14
leaq 0x70(%rsp), %rbx
movl $0x372, %edx            # imm = 0x372
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5320
movw $0x101, 0x165(%rbx)     # imm = 0x101
testq %r14, %r14
je 0x88fb
movq %r14, 0x58(%rsp)
movq %r14, %rdi
callq 0x5670
movq %rax, %r12
xorl %ebp, %ebp
movq %rax, 0x40(%rsp)
movq %rbp, %r15
shlq $0x5, %r15
movzbl 0x2(%r12,%r15), %ebx
testl %ebx, %ebx
je 0x87e5
movl %ebx, %r14d
andl $0xf, %r14d
callq 0x5390
movq %rax, %r13
movq %rax, %rdi
movl %r14d, %esi
callq 0x5110
movl %eax, %ecx
testl %eax, %eax
jns 0x8467
movq 0x10(%rsp), %rax
testb $0x1, 0x1(%rax)
jne 0x8467
movq %r13, %rdi
callq 0x50e0
jmp 0x87e5
movl %ecx, 0x20(%rsp)
addq %r12, %r15
movl %ebx, %esi
shrl $0x6, %esi
andl $0x1, %esi
shrb $0x7, %bl
movzbl %bl, %r12d
movq %r13, %rdi
callq 0x53f0
movq %r13, %rdi
movl %r12d, %esi
callq 0x56b0
cmpl $0x4, %r14d
movq %r13, %rbx
jne 0x84ae
movzbl 0x17(%r15), %esi
movq %rbx, %rdi
callq 0x5580
testl %eax, %eax
js 0x8731
movb $0x10, %al
movq 0x50(%rsp), %r13
movl %r14d, 0x28(%rsp)
movzbl %al, %ecx
cmpb $-0x60, 0x4(%r15,%rcx)
jne 0x84cb
decb %al
jne 0x84ba
xorl %eax, %eax
leaq 0x5(%r15), %rsi
movzbl %al, %edx
movq %rbx, %rdi
callq 0x52f0
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5360
movq %rax, %r12
movq %rbx, %rdi
callq 0x5780
movl %eax, %edi
callq 0x56a0
movl $0x4, %edi
leaq 0x6798(%rip), %rsi      # 0xec9a
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x5949
movzwl 0x1e(%r15), %r12d
testq %r13, %r13
movl 0x28(%rsp), %r14d
movl 0x20(%rsp), %edi
je 0x85c8
movl 0x8(%r13), %eax
cmpl 0xc(%r13), %eax
jne 0x8551
addl $0x90, %eax
movl %eax, 0xc(%r13)
movq (%r13), %rdi
addq %rax, %rax
leaq (%rax,%rax,2), %rsi
callq 0x587c
movl 0x20(%rsp), %edi
movq %rax, (%r13)
testl %edi, %edi
sets %al
testl %r14d, %r14d
setne %cl
orb %al, %cl
jne 0x857a
movq (%r13), %rcx
movl 0x8(%r13), %eax
leaq (%rax,%rax,2), %rdx
movw $0x0, 0x2(%rcx,%rdx,2)
movw %r12w, (%rcx,%rdx,2)
jmp 0x85b7
movb 0x3(%r15), %sil
movq (%r13), %rcx
movl 0x8(%r13), %eax
leaq (%rax,%rax,2), %rdx
movb %sil, 0x2(%rcx,%rdx,2)
movb 0x4(%r15), %sil
movb %sil, 0x3(%rcx,%rdx,2)
movw %r12w, (%rcx,%rdx,2)
cmpl $0x4, %r14d
jne 0x85b7
movb 0x15(%r15), %sil
movb %sil, 0x4(%rcx,%rdx,2)
movb 0x16(%r15), %sil
movb %sil, 0x5(%rcx,%rdx,2)
jmp 0x85c2
leaq (%rax,%rax,2), %rdx
movw $0x0, 0x4(%rcx,%rdx,2)
incl %eax
movl %eax, 0x8(%r13)
movw %r12w, 0x36(%rsp)
movq %rbx, 0x20(%rsp)
testl %edi, %edi
setns %al
testl %r14d, %r14d
sete %cl
testb %al, %cl
jne 0x8794
movq 0x20(%rsp), %rdi
callq 0x5610
movq %rax, 0x68(%rsp)
movb 0x3(%r15), %bl
movb 0x4(%r15), %r14b
cmpb $0x12, %bl
sete %al
cmpb $0x2, %r14b
setb %cl
andb %al, %cl
testb %bl, %bl
sete %al
orb %cl, %al
jne 0x8794
xorl %r13d, %r13d
movzbl %bl, %r12d
cmpb 0x38(%rsp), %r12b
ja 0x8756
cmpl $0x12, %r12d
jne 0x865d
movq 0x10(%rsp), %rax
movl (%rax), %eax
andl $0x2, %eax
jne 0x865d
movl $0x1, %edi
leaq 0x669a(%rip), %rsi      # 0xece3
callq 0x591c
movq 0x10(%rsp), %rax
testb $0x1, 0x1(%rax)
je 0x8777
movzbl %r14b, %r14d
movq 0x48(%rsp), %rdi
movl %r12d, %esi
movl %r14d, %edx
callq 0x50c0
testq %rax, %rax
je 0x8743
leal -0x1(%r12), %eax
leaq (%rax,%rax,4), %rcx
leaq (%rax,%rcx,4), %rax
leaq (%rsp,%rax), %rcx
addq $0x70, %rcx
cmpb $0x0, (%r14,%rcx)
jne 0x8743
addq %r14, %rcx
movb $0x1, (%rcx)
movq 0x18(%rsp), %rcx
testq %rcx, %rcx
je 0x86b7
cmpb $0x29, %bl
jb 0x86b7
addq %rcx, %rax
movb $0x1, (%r14,%rax)
movq 0x48(%rsp), %rdi
movl %r12d, %esi
movl %r14d, %edx
callq 0x50c0
movq %rax, %rdi
callq 0x5670
movb (%rax), %bl
movb 0x1(%rax), %r14b
movl $0x1, %ecx
testl %r13d, %r13d
jne 0x8724
movzbl %r14b, %edx
decq %rdx
testb %bl, %bl
movl $0xfe, %ecx
cmovneq %rcx, %rdx
addq $0x2, %rax
movq 0x68(%rsp), %rdi
movq %rax, %rsi
callq 0x5720
testl %eax, %eax
js 0x87f4
xorl %ecx, %ecx
cmpl $0x4, 0x28(%rsp)
jne 0x8724
testb %bl, %bl
jne 0x8724
movb 0x15(%r15), %bl
movb 0x16(%r15), %r14b
movl $0x1, %ecx
movl %ecx, %r13d
testb %bl, %bl
jne 0x861c
jmp 0x8794
movq %rbx, %rdi
callq 0x50e0
movq 0x40(%rsp), %r12
jmp 0x87e5
movl $0x1, %edi
leaq 0x65cf(%rip), %rsi      # 0xed1e
callq 0x591c
jmp 0x876c
movl $0x1, %edi
leaq 0x655a(%rip), %rsi      # 0xecbc
movl %r12d, %edx
xorl %eax, %eax
callq 0x5949
movq 0x10(%rsp), %rax
testb $0x1, 0x1(%rax)
jne 0x8794
movq 0x20(%rsp), %rdi
callq 0x50e0
movl $0xffffffff, 0xc(%rsp)  # imm = 0xFFFFFFFF
movq $0x0, 0x58(%rsp)
jmp 0x87d2
movq 0x20(%rsp), %r14
testq %r14, %r14
je 0x87d2
movq %r14, %rdi
callq 0x5680
movzwl 0x36(%rsp), %ecx
cmpw %cx, %ax
movq 0x60(%rsp), %rbx
movq 0x40(%rsp), %r12
je 0x87c5
movzwl %cx, %esi
movq %r14, %rdi
callq 0x5260
movq %rbx, %rdi
movq %r14, %rsi
callq 0x54b0
jmp 0x87e5
movq 0x50(%rsp), %r13
movq 0x40(%rsp), %r12
testq %r13, %r13
je 0x87e5
decl 0x8(%r13)
incq %rbp
cmpq $0x8, %rbp
jne 0x841a
jmp 0x880a
movl $0x1, %edi
leaq 0x6541(%rip), %rsi      # 0xed41
callq 0x591c
jmp 0x8777
cmpq $0x0, 0x58(%rsp)
movq 0x18(%rsp), %rsi
movq 0x48(%rsp), %rdi
je 0x8906
movb (%r12), %al
testb %al, %al
je 0x8906
movzbl 0x1(%r12), %edx
movzbl %al, %esi
callq 0x50c0
testq %rax, %rax
je 0x890c
movq %rax, %r14
movzbl (%r12), %edx
leaq (%rdx,%rdx,4), %rax
leaq (%rdx,%rax,4), %rax
movzbl 0x1(%r12), %ecx
addq %rsp, %rax
addq $0x70, %rax
cmpb $0x0, -0x15(%rcx,%rax)
movq 0x10(%rsp), %rbx
je 0x8888
movl $0x1, %edi
leaq 0x64a6(%rip), %rsi      # 0xed1e
callq 0x591c
testb $0x1, 0x1(%rbx)
jne 0x88a2
jmp 0x892d
cmpl $0x12, %edx
je 0x8898
movl (%rbx), %eax
andl $0x1, %eax
je 0x8939
cmpb 0x38(%rsp), %dl
ja 0x894c
cmpl $0x0, 0xc(%rsp)
jne 0x8403
movb (%r12), %dl
movzbl %dl, %eax
leaq (%rax,%rax,4), %rcx
leaq (%rax,%rcx,4), %rsi
movzbl 0x1(%r12), %ecx
addq %rsp, %rsi
addq $0x70, %rsi
movb $0x1, -0x15(%rcx,%rsi)
cmpq $0x0, 0x18(%rsp)
je 0x8403
cmpb $0x29, %dl
jb 0x8403
decl %eax
leaq (%rax,%rax,4), %rdx
leaq (%rax,%rdx,4), %rax
addq 0x18(%rsp), %rax
movb $0x1, (%rcx,%rax)
jmp 0x8403
movq 0x18(%rsp), %rsi
movl 0xc(%rsp), %eax
jmp 0x8975
movl 0xc(%rsp), %edx
jmp 0x8973
leaq 0x640b(%rip), %rsi      # 0xed1e
movl $0x1, %edi
callq 0x591c
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq 0x10(%rsp), %rcx
testb $0x1, 0x1(%rcx)
jmp 0x8968
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq 0x18(%rsp), %rsi
jmp 0x8973
leaq 0x6429(%rip), %rsi      # 0xed69
movl $0x1, %edi
callq 0x591c
jmp 0x895f
leaq 0x6369(%rip), %rsi      # 0xecbc
movl $0x1, %edi
xorl %eax, %eax
callq 0x5949
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
testb $0x1, 0x1(%rbx)
movq 0x18(%rsp), %rsi
movl 0xc(%rsp), %eax
jne 0x8975
movl %edx, %eax
testq %rsi, %rsi
leaq 0x70(%rsp), %r8
je 0x89b4
testl %eax, %eax
jne 0x89b4
xorl %edi, %edi
xorl %eax, %eax
xorl %ecx, %ecx
movb (%rsi,%rcx), %dl
cmpb (%r8,%rcx), %dl
jne 0x89af
incq %rcx
cmpq $0x15, %rcx
jne 0x8989
incb %dil
addq $0x15, %rsi
addq $0x15, %r8
cmpb 0x38(%rsp), %dil
jne 0x8987
jmp 0x89b4
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
addq $0x3e8, %rsp            # imm = 0x3E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq