// File: /workspace/github_c_makefile_star2_O2/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, %r12
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r13
movq %rdi, %rbp
callq 0x5250
testl %eax, %eax
je 0x7f90
pushq $-0x1
popq %rbx
leaq 0x5ced(%rip), %rsi      # 0xdc70
pushq $0x1
popq %rdi
callq 0x5960
jmp 0x87e1
movq %rbx, 0x30(%rsp)
pushq $0x12
popq %rsi
xorl %r15d, %r15d
movq %r13, %rdi
xorl %edx, %edx
callq 0x50c0
movq %rax, %rdi
callq 0x56b0
movq %rax, %rbx
movzbl 0x2(%rax), %esi
movq %rbp, 0x48(%rsp)
movq %rbp, %rdi
callq 0x5630
movq %r14, (%rsp)
testb $0x40, (%r14)
pushq $0x14
popq %r14
cmoveq %r15, %r14
movq %rbx, %r15
leaq (%rbx,%r14), %rax
addq $0x8f, %rax
movb $0x10, %cl
movq %r13, %rbx
movzbl %cl, %edx
subb $0x1, %cl
jb 0x7ff1
cmpb $-0x60, (%rax,%rdx)
je 0x7fe3
leaq (%r15,%r14), %rsi
addq $0x90, %rsi
movq 0x48(%rsp), %rdi
callq 0x5540
movb 0xa6(%r15,%r14), %cl
movb $0x5, %al
cmpb 0x2(%r15), %cl
jne 0x804c
movb $0x4, %al
cmpb $0x32, 0xa5(%r15,%r14)
jne 0x804c
movb $0x3, %al
cmpb $-0x60, 0xa4(%r15,%r14)
jne 0x804c
movl %r14d, %ecx
movb $0x2, %al
cmpb $-0x60, 0xa3(%r15,%rcx)
jne 0x804c
cmpb $-0x60, 0xa2(%r15,%rcx)
setne %al
leaq (%r15,%r14), %rsi
addq $0xa2, %rsi
movzbl %al, %edx
movq 0x48(%rsp), %rdi
callq 0x5560
movl $0x0, %r14d
cmpq $0x0, 0x30(%rsp)
movq %rbx, 0x10(%rsp)
movq %r12, 0x40(%rsp)
je 0x819f
movq 0x30(%rsp), %rax
movq %r15, %rcx
leaq -0x15(%rax), %r15
leaq 0x1c(%rcx), %rax
movq %rax, 0x8(%rsp)
movq %rcx, 0x38(%rsp)
leaq 0x30(%rcx), %rax
movq %rax, 0x28(%rsp)
xorl %r14d, %r14d
movb $0x1, %r12b
movq %rbx, %rdi
callq 0x5620
cmpb %al, %r12b
ja 0x819a
movzbl %r12b, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x5060
movq %rax, %rdi
callq 0x5780
movl %ebp, %r13d
movzbl %al, %ebp
cmpb $0x23, %r12b
ja 0x810e
imulq $0x15, %r13, %rdi
addq %r15, %rdi
movq 0x38(%rsp), %rax
leaq (%rax,%r13,4), %rdx
movl %ebp, %esi
callq 0x87f5
testl %eax, %eax
jns 0x8192
movq (%rsp), %rax
testb $-0x80, (%rax)
pushq $-0x2
popq %rax
cmovel %eax, %r14d
jmp 0x8192
movq (%rsp), %rax
movl (%rax), %ecx
testb $0xc, %cl
je 0x8192
cmpb $0x28, %r12b
ja 0x8192
testb $0x10, %cl
je 0x8156
imulq $0x15, %r13, %rdi
addq %r15, %rdi
movq 0x8(%rsp), %rcx
leaq (%rcx,%r13,4), %rdx
movl %ebp, %esi
movq %rax, %rbx
callq 0x87f5
movl (%rbx), %ecx
testl %eax, %eax
jns 0x814d
testb %cl, %cl
pushq $-0x2
popq %rax
cmovnsl %eax, %r14d
movq (%rsp), %rax
movq 0x10(%rsp), %rbx
testb $0x20, %cl
je 0x8189
imulq $0x15, %r13, %rdi
addq %r15, %rdi
movq 0x28(%rsp), %rcx
leaq (%rcx,%r13,4), %rdx
movl %ebp, %esi
movq %rax, %rbx
callq 0x87f5
movl (%rbx), %ecx
testl %eax, %eax
jns 0x8184
testb %cl, %cl
pushq $-0x2
popq %rax
cmovnsl %eax, %r14d
movq 0x10(%rsp), %rbx
testb $0x40, %cl
jne 0x80dc
incb %r12b
jmp 0x80a9
movq 0x40(%rsp), %r12
movq (%rsp), %rax
movl (%rax), %eax
xorl %ecx, %ecx
testb $0x4, %al
setne %cl
leal (%rcx,%rcx,4), %ecx
addl $0x23, %ecx
testb $0x8, %al
pushq $0x2a
popq %rax
cmovel %ecx, %eax
movl %eax, 0x38(%rsp)
pushq $0x12
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0x50c0
movq %rax, %r13
leaq 0x70(%rsp), %rbx
movl $0x372, %edx            # imm = 0x372
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5330
movw $0x101, 0x165(%rbx)     # imm = 0x101
testq %r13, %r13
je 0x8787
movq %r13, 0x68(%rsp)
movq %r13, %rdi
callq 0x56b0
movq %rax, 0x28(%rsp)
xorl %r15d, %r15d
movl %r14d, %eax
movq %rax, 0x20(%rsp)
cmpq $0x8, %r15
je 0x8603
movq %r15, %r13
shlq $0x5, %r13
movq 0x28(%rsp), %r14
movzbl 0x2(%r14,%r13), %ebp
testl %ebp, %ebp
je 0x85fb
movq %r12, %rbx
movq %r15, 0x8(%rsp)
movl %ebp, %r15d
andl $0xf, %r15d
callq 0x53b0
movq %rax, %r12
movq %rax, %rdi
movl %r15d, %esi
callq 0x5110
movl %eax, 0x58(%rsp)
testl %eax, %eax
jns 0x8272
movq (%rsp), %rax
testb $0x1, 0x1(%rax)
jne 0x8272
movq %r12, %rdi
jmp 0x8539
addq %r14, %r13
movl %ebp, %esi
shrl $0x6, %esi
andl $0x1, %esi
shrb $0x7, %bpl
movzbl %bpl, %r14d
movq %r12, %rdi
callq 0x5420
movq %r12, %rdi
movl %r14d, %esi
callq 0x56f0
movl %r15d, 0x64(%rsp)
cmpl $0x4, %r15d
movq %r12, %rbp
jne 0x82bb
movzbl 0x17(%r13), %esi
movq %rbp, %rdi
callq 0x55b0
testl %eax, %eax
js 0x8536
movb $0x10, %al
movq %rbx, %r12
movzbl %al, %edx
subb $0x1, %al
jb 0x82cf
cmpb $-0x60, 0x4(%r13,%rdx)
je 0x82c0
leaq 0x5(%r13), %rsi
movq %rbp, %rdi
callq 0x5300
movq %rbp, %rdi
xorl %esi, %esi
callq 0x5370
movq %rax, %r14
movq %rbp, %rdi
callq 0x57c0
movl %eax, %edi
callq 0x56e0
pushq $0x4
popq %rdi
leaq 0x5999(%rip), %rsi      # 0xdc9a
movq %r14, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x598d
movzwl 0x1e(%r13), %edi
testq %r12, %r12
movl 0x64(%rsp), %ebx
movl 0x58(%rsp), %r15d
je 0x83cb
movl 0x8(%r12), %eax
cmpl 0xc(%r12), %eax
jne 0x8352
addl $0x90, %eax
movl %eax, 0xc(%r12)
movl %edi, %r14d
movq (%r12), %rdi
imulq $0x6, %rax, %rsi
callq 0x58bc
movl %r14d, %edi
movq %rax, (%r12)
testl %r15d, %r15d
sets %al
testl %ebx, %ebx
setne %cl
orb %al, %cl
jne 0x837a
movq (%r12), %rcx
movl 0x8(%r12), %eax
imulq $0x6, %rax, %rdx
andw $0x0, 0x2(%rcx,%rdx)
movw %di, (%rcx,%rdx)
jmp 0x83b1
movl 0x8(%r12), %eax
imulq $0x6, %rax, %rdx
movb 0x3(%r13), %sil
movq (%r12), %rcx
movb %sil, 0x2(%rcx,%rdx)
movb 0x4(%r13), %sil
movb %sil, 0x3(%rcx,%rdx)
movw %di, (%rcx,%rdx)
cmpl $0x4, %ebx
jne 0x83b1
movb 0x15(%r13), %sil
movb %sil, 0x4(%rcx,%rdx)
movb 0x16(%r13), %dl
jmp 0x83bc
imulq $0x6, %rax, %rdx
movb $0x0, 0x4(%rcx,%rdx)
xorl %edx, %edx
imulq $0x6, %rax, %rsi
movb %dl, 0x5(%rcx,%rsi)
incl %eax
movl %eax, 0x8(%r12)
movw %di, 0x1e(%rsp)
movq %rbp, 0x50(%rsp)
testl %r15d, %r15d
setns %al
testl %ebx, %ebx
sete %cl
testb %al, %cl
jne 0x857a
movq 0x50(%rsp), %rdi
callq 0x5640
movq %rax, 0x58(%rsp)
movzbl 0x3(%r13), %eax
movb 0x4(%r13), %r12b
cmpb $0x2, %r12b
movl %eax, %r15d
movl $0x0, %ecx
cmovbl %ecx, %r15d
cmpb $0x12, %al
cmovnel %eax, %r15d
movb $0x1, %bpl
testb %r15b, %r15b
je 0x857a
movzbl %r15b, %r14d
cmpb 0x38(%rsp), %r15b
ja 0x855c
cmpb $0x12, %r15b
jne 0x845f
movq (%rsp), %rax
movl (%rax), %eax
andl $0x2, %eax
jne 0x845f
pushq $0x1
popq %rdi
leaq 0x5897(%rip), %rsi      # 0xdce3
callq 0x5960
movq (%rsp), %rax
testb $0x1, 0x1(%rax)
je 0x85cc
movzbl %r12b, %r12d
movq 0x10(%rsp), %rdi
movl %r14d, %esi
movl %r12d, %edx
callq 0x50c0
testq %rax, %rax
je 0x854b
leal -0x1(%r14), %eax
imulq $0x15, %rax, %rax
leaq (%rsp,%rax), %rcx
addq $0x70, %rcx
cmpb $0x0, (%r12,%rcx)
jne 0x854b
addq %r12, %rcx
movb $0x1, (%rcx)
movq 0x30(%rsp), %rcx
testq %rcx, %rcx
je 0x84b5
cmpb $0x29, %r15b
jb 0x84b5
addq %rcx, %rax
movb $0x1, (%r12,%rax)
movq 0x10(%rsp), %rdi
movl %r14d, %esi
movl %r12d, %edx
callq 0x50c0
movq %rax, %rdi
callq 0x56b0
movb (%rax), %r15b
movb 0x1(%rax), %r12b
testb $0x1, %bpl
movl $0x0, %ebp
je 0x8419
movzbl %r12b, %edx
decq %rdx
testb %r15b, %r15b
movl $0xfe, %ecx
cmovneq %rcx, %rdx
addq $0x2, %rax
movq 0x58(%rsp), %rdi
movq %rax, %rsi
callq 0x5760
testl %eax, %eax
js 0x85bd
movb $0x1, %bpl
cmpl $0x4, %ebx
jne 0x8419
movb $0x1, %bpl
testb %r15b, %r15b
jne 0x8419
movb 0x15(%r13), %r15b
movb 0x16(%r13), %r12b
xorl %ebp, %ebp
jmp 0x8419
movq %rbp, %rdi
callq 0x50e0
movq 0x8(%rsp), %r15
movq %rbx, %r12
jmp 0x85fb
pushq $0x1
popq %rdi
leaq 0x57c9(%rip), %rsi      # 0xdd1e
callq 0x5960
jmp 0x8570
pushq $0x1
popq %rdi
leaq 0x5756(%rip), %rsi      # 0xdcbc
movl %r14d, %edx
xorl %eax, %eax
callq 0x598d
movq (%rsp), %rax
testb $0x1, 0x1(%rax)
je 0x85cc
movq 0x50(%rsp), %r14
testq %r14, %r14
je 0x85e7
movq %r14, %rdi
callq 0x56c0
movzwl 0x1e(%rsp), %ecx
cmpw %cx, %ax
movq 0x40(%rsp), %r12
movq 0x48(%rsp), %rbx
movq 0x8(%rsp), %r15
je 0x85b0
movzwl %cx, %esi
movq %r14, %rdi
callq 0x5270
movq %rbx, %rdi
movq %r14, %rsi
callq 0x54e0
jmp 0x85fb
pushq $0x1
popq %rdi
leaq 0x577a(%rip), %rsi      # 0xdd41
callq 0x5960
movq 0x50(%rsp), %rdi
callq 0x50e0
pushq $-0x1
popq %rax
movq %rax, 0x20(%rsp)
movq $0x0, 0x68(%rsp)
movq 0x40(%rsp), %r12
movq 0x8(%rsp), %r15
testq %r12, %r12
je 0x85fb
decl 0x8(%r12)
incq %r15
jmp 0x8212
movq 0x20(%rsp), %rcx
movl %ecx, %r14d
cmpq $0x0, 0x68(%rsp)
movl $0x0, %r13d
je 0x81ec
movq 0x28(%rsp), %rax
movb (%rax), %al
movl $0x0, %r13d
movl %ecx, %r14d
testb %al, %al
je 0x81ec
movq 0x28(%rsp), %r14
movzbl 0x1(%r14), %edx
movzbl %al, %esi
movq 0x10(%rsp), %rdi
callq 0x50c0
testq %rax, %rax
je 0x86a1
movq %rax, %rbx
movzbl (%r14), %edx
imulq $0x15, %rdx, %rax
movzbl 0x1(%r14), %ecx
leaq 0x70(%rsp), %rsi
addq %rsi, %rax
cmpb $0x0, -0x15(%rcx,%rax)
je 0x86ad
pushq $0x1
popq %rdi
leaq 0x56a4(%rip), %rsi      # 0xdd1e
callq 0x5960
movq (%rsp), %rax
testb $0x1, 0x1(%rax)
movl $0x0, %r13d
pushq $-0x1
popq %r14
movq 0x20(%rsp), %r15
je 0x81ec
jmp 0x8724
pushq $0x1
popq %rdi
leaq 0x5673(%rip), %rsi      # 0xdd1e
jmp 0x86c7
cmpl $0x12, %edx
je 0x86ee
movq (%rsp), %rax
movl (%rax), %eax
andl $0x1, %eax
jne 0x86ee
pushq $0x1
popq %rdi
leaq 0x56a2(%rip), %rsi      # 0xdd69
callq 0x5960
movq (%rsp), %rax
testb $0x1, 0x1(%rax)
movl $0x0, %r13d
pushq $-0x1
popq %r14
movq 0x20(%rsp), %r15
je 0x81ec
jmp 0x878a
cmpb 0x38(%rsp), %dl
movq 0x20(%rsp), %r15
jbe 0x8724
pushq $0x1
popq %rdi
leaq 0x55b9(%rip), %rsi      # 0xdcbc
xorl %eax, %eax
callq 0x598d
movq (%rsp), %rax
testb $0x1, 0x1(%rax)
movl $0x0, %r13d
pushq $-0x1
popq %r14
je 0x81ec
jmp 0x878a
movq %rbx, %r13
movl %r15d, %r14d
testl %r15d, %r15d
jne 0x81ec
movq 0x28(%rsp), %rdi
movb (%rdi), %dl
movzbl %dl, %eax
imulq $0x15, %rax, %rsi
leaq 0x70(%rsp), %rcx
addq %rcx, %rsi
xorl %r14d, %r14d
movzbl 0x1(%rdi), %ecx
movb $0x1, -0x15(%rcx,%rsi)
movq %rbx, %r13
cmpq $0x0, 0x30(%rsp)
je 0x81ec
movq %rbx, %r13
cmpb $0x29, %dl
jb 0x81ec
decl %eax
imulq $0x15, %rax, %rax
addq 0x30(%rsp), %rax
movb $0x1, (%rcx,%rax)
movq %rbx, %r13
jmp 0x81ec
movl %r14d, %r15d
movq %r15, %rbx
movq 0x30(%rsp), %rdx
testq %rdx, %rdx
je 0x87e1
testl %ebx, %ebx
jne 0x87e1
movzbl 0x38(%rsp), %eax
xorl %ebx, %ebx
xorl %ecx, %ecx
leaq 0x70(%rsp), %r9
cmpq %rax, %rcx
je 0x87e1
movq %rdx, %r8
xorl %edx, %edx
cmpq $0x15, %rdx
je 0x87cc
movb (%r8,%rdx), %sil
leaq 0x1(%rdx), %rdi
cmpb (%r9,%rdx), %sil
movq %rdi, %rdx
je 0x87b3
jmp 0x87dc
incq %rcx
movq %r8, %rdx
addq $0x15, %rdx
addq $0x15, %r9
jmp 0x87a9
pushq $-0x2
popq %rax
movl %eax, %ebx
movl %ebx, %eax
addq $0x3e8, %rsp            # imm = 0x3E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq