// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x450, %rsp            # imm = 0x450
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5260
cmpl $0x0, %eax
je 0xa00a
movl $0x1, %edi
leaq 0x9ca7(%rip), %rsi      # 0x13ca0
callq 0x5a60
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xaefb
movq -0x18(%rbp), %rdi
movl $0x12, %esi
xorl %edx, %edx
callq 0x50c0
movq %rax, %rdi
callq 0x56d0
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rax
movzbl 0x2(%rax), %esi
callq 0x5640
movb $0x0, -0x39(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0xa04d
movb $0x14, -0x39(%rbp)
movb $0x10, -0x3a(%rbp)
movzbl -0x3a(%rbp), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x433(%rbp)
je 0xa08b
movq -0x38(%rbp), %rax
movzbl -0x3a(%rbp), %ecx
addl $0x8f, %ecx
movzbl -0x39(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0xa0, %eax
sete %al
movb %al, -0x433(%rbp)
movb -0x433(%rbp), %al
testb $0x1, %al
jne 0xa097
jmp 0xa0a1
movb -0x3a(%rbp), %al
addb $-0x1, %al
movb %al, -0x3a(%rbp)
jmp 0xa051
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
addq $0x90, %rsi
movzbl -0x39(%rbp), %eax
cltq
addq %rax, %rsi
movzbl -0x3a(%rbp), %edx
callq 0x5560
movb $0x5, -0x3b(%rbp)
movq -0x38(%rbp), %rax
movzbl -0x39(%rbp), %ecx
addl $0xa6, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movq -0x38(%rbp), %rcx
movzbl 0x2(%rcx), %ecx
cmpl %ecx, %eax
jne 0xa189
movb -0x3b(%rbp), %al
addb $-0x1, %al
movb %al, -0x3b(%rbp)
movq -0x38(%rbp), %rax
movzbl -0x39(%rbp), %ecx
addl $0xa5, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x32, %eax
jne 0xa187
movb -0x3b(%rbp), %al
addb $-0x1, %al
movb %al, -0x3b(%rbp)
movq -0x38(%rbp), %rax
movzbl -0x39(%rbp), %ecx
addl $0xa4, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0xa0, %eax
jne 0xa185
movb -0x3b(%rbp), %al
addb $-0x1, %al
movb %al, -0x3b(%rbp)
movq -0x38(%rbp), %rax
movzbl -0x39(%rbp), %ecx
addl $0xa3, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0xa0, %eax
jne 0xa183
movb -0x3b(%rbp), %al
addb $-0x1, %al
movb %al, -0x3b(%rbp)
movq -0x38(%rbp), %rax
movzbl -0x39(%rbp), %ecx
addl $0xa2, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0xa0, %eax
jne 0xa181
movb -0x3b(%rbp), %al
addb $-0x1, %al
movb %al, -0x3b(%rbp)
jmp 0xa183
jmp 0xa185
jmp 0xa187
jmp 0xa189
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
addq $0xa2, %rsi
movzbl -0x39(%rbp), %eax
cltq
addq %rax, %rsi
movzbl -0x3b(%rbp), %edx
callq 0x5580
movl $0x0, -0x40(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0xa3b0
movb $0x1, -0x41(%rbp)
movzbl -0x41(%rbp), %eax
movl %eax, -0x438(%rbp)
movq -0x18(%rbp), %rdi
callq 0x5630
movb %al, %cl
movl -0x438(%rbp), %eax
movzbl %cl, %ecx
cmpl %ecx, %eax
jg 0xa3ae
movq -0x18(%rbp), %rdi
movzbl -0x41(%rbp), %esi
callq 0x5050
movq %rax, %rdi
callq 0x57b0
movb %al, -0x42(%rbp)
movzbl -0x41(%rbp), %eax
cmpl $0x24, %eax
jge 0xa25a
movq -0x28(%rbp), %rdi
movzbl -0x41(%rbp), %eax
subl $0x1, %eax
cltq
imulq $0x15, %rax, %rax
addq %rax, %rdi
movb -0x42(%rbp), %al
movq -0x38(%rbp), %rdx
movzbl -0x41(%rbp), %ecx
shll $0x2, %ecx
movslq %ecx, %rcx
addq %rcx, %rdx
movzbl %al, %esi
callq 0xaf10
cmpl $0x0, %eax
jge 0xa255
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
jne 0xa253
movl $0xfffffffe, -0x40(%rbp) # imm = 0xFFFFFFFE
jmp 0xa255
jmp 0xa39f
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0xc, %eax
cmpl $0x0, %eax
je 0xa39d
movzbl -0x41(%rbp), %eax
cmpl $0x29, %eax
jge 0xa39d
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0xa2db
movq -0x28(%rbp), %rdi
movzbl -0x41(%rbp), %eax
subl $0x1, %eax
cltq
imulq $0x15, %rax, %rax
addq %rax, %rdi
movb -0x42(%rbp), %al
movq -0x38(%rbp), %rdx
addq $0x1c, %rdx
movzbl -0x41(%rbp), %ecx
shll $0x2, %ecx
movslq %ecx, %rcx
addq %rcx, %rdx
movzbl %al, %esi
callq 0xaf10
cmpl $0x0, %eax
jge 0xa2d9
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
jne 0xa2d7
movl $0xfffffffe, -0x40(%rbp) # imm = 0xFFFFFFFE
jmp 0xa2d9
jmp 0xa2db
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0xa33d
movq -0x28(%rbp), %rdi
movzbl -0x41(%rbp), %eax
subl $0x1, %eax
cltq
imulq $0x15, %rax, %rax
addq %rax, %rdi
movb -0x42(%rbp), %al
movq -0x38(%rbp), %rdx
addq $0x30, %rdx
movzbl -0x41(%rbp), %ecx
shll $0x2, %ecx
movslq %ecx, %rcx
addq %rcx, %rdx
movzbl %al, %esi
callq 0xaf10
cmpl $0x0, %eax
jge 0xa33b
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
jne 0xa339
movl $0xfffffffe, -0x40(%rbp) # imm = 0xFFFFFFFE
jmp 0xa33b
jmp 0xa33d
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0xa39b
movq -0x28(%rbp), %rdi
movzbl -0x41(%rbp), %eax
subl $0x1, %eax
cltq
imulq $0x15, %rax, %rax
addq %rax, %rdi
movb -0x42(%rbp), %al
movq -0x38(%rbp), %rdx
movzbl -0x41(%rbp), %ecx
shll $0x2, %ecx
movslq %ecx, %rcx
addq %rcx, %rdx
movzbl %al, %esi
callq 0xaf10
cmpl $0x0, %eax
jge 0xa399
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
jne 0xa397
movl $0xfffffffe, -0x40(%rbp) # imm = 0xFFFFFFFE
jmp 0xa399
jmp 0xa39b
jmp 0xa39d
jmp 0xa39f
jmp 0xa3a1
movb -0x41(%rbp), %al
addb $0x1, %al
movb %al, -0x41(%rbp)
jmp 0xa1c0
jmp 0xa3b0
movb $0x23, -0x43(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0xa3c6
movb $0x28, -0x43(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0xa3d8
movb $0x2a, -0x43(%rbp)
movq -0x18(%rbp), %rdi
movl $0x12, %esi
movl $0x1, %edx
callq 0x50c0
movq %rax, -0x50(%rbp)
leaq -0x3d0(%rbp), %rdi
xorl %esi, %esi
movl $0x372, %edx            # imm = 0x372
callq 0x5340
movb $0x1, -0x26b(%rbp)
movb $0x1, -0x26a(%rbp)
cmpq $0x0, -0x50(%rbp)
je 0xae3c
movq -0x50(%rbp), %rdi
callq 0x56d0
movq %rax, -0x3d8(%rbp)
movb $0x0, -0x3d9(%rbp)
movzbl -0x3d9(%rbp), %eax
cmpl $0x8, %eax
jge 0xac2c
movq -0x3d8(%rbp), %rax
movzbl -0x3d9(%rbp), %ecx
shll $0x5, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x3e8(%rbp)
movq -0x3e8(%rbp), %rax
cmpb $0x0, 0x2(%rax)
je 0xac17
movq -0x3e8(%rbp), %rax
movzbl 0x2(%rax), %eax
andl $0xf, %eax
movl %eax, -0x3ec(%rbp)
movl $0x0, -0x3f0(%rbp)
movq -0x3e8(%rbp), %rax
movzbl 0x2(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x3f4(%rbp)
movq -0x3e8(%rbp), %rax
movzbl 0x2(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x3f8(%rbp)
callq 0x53c0
movq %rax, -0x400(%rbp)
movq -0x400(%rbp), %rdi
movl -0x3ec(%rbp), %esi
callq 0x5110
cmpl $0x0, %eax
jge 0xa529
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0xa516
movl $0x1, -0x3f0(%rbp)
jmp 0xa527
movq -0x400(%rbp), %rdi
callq 0x50e0
jmp 0xac19
jmp 0xa529
movq -0x400(%rbp), %rdi
movl -0x3f4(%rbp), %esi
callq 0x5440
movq -0x400(%rbp), %rdi
movl -0x3f8(%rbp), %esi
callq 0x5720
cmpl $0x4, -0x3ec(%rbp)
jne 0xa585
movq -0x400(%rbp), %rdi
movq -0x3e8(%rbp), %rax
movzbl 0x17(%rax), %esi
callq 0x55c0
cmpl $0x0, %eax
jge 0xa583
movq -0x400(%rbp), %rdi
callq 0x50e0
jmp 0xac19
jmp 0xa585
movb $0x10, -0x401(%rbp)
movzbl -0x401(%rbp), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x439(%rbp)
je 0xa5c6
movq -0x3e8(%rbp), %rax
movzbl -0x401(%rbp), %ecx
addl $0x4, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0xa0, %eax
sete %al
movb %al, -0x439(%rbp)
movb -0x439(%rbp), %al
testb $0x1, %al
jne 0xa5d2
jmp 0xa5e2
movb -0x401(%rbp), %al
addb $-0x1, %al
movb %al, -0x401(%rbp)
jmp 0xa58c
movq -0x400(%rbp), %rdi
movq -0x3e8(%rbp), %rsi
addq $0x5, %rsi
movzbl -0x401(%rbp), %edx
callq 0x5310
movq -0x400(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x5380
movq %rax, -0x448(%rbp)
movq -0x400(%rbp), %rdi
callq 0x57f0
movl %eax, %edi
callq 0x5700
movq -0x448(%rbp), %rdx
movq %rax, %rcx
movl $0x4, %edi
leaq 0x968a(%rip), %rsi      # 0x13cca
movb $0x0, %al
callq 0x5ab0
movq -0x3e8(%rbp), %rax
movzbl 0x1f(%rax), %eax
shll $0x8, %eax
movq -0x3e8(%rbp), %rcx
movzbl 0x1e(%rcx), %ecx
orl %ecx, %eax
movw %ax, -0x404(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0xa7ec
movq -0x30(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x30(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jne 0xa6b5
movq -0x30(%rbp), %rax
movl 0xc(%rax), %ecx
addl $0x90, %ecx
movl %ecx, 0xc(%rax)
movq -0x30(%rbp), %rax
movq (%rax), %rdi
movq -0x30(%rbp), %rax
movl 0xc(%rax), %eax
imulq $0x6, %rax, %rsi
callq 0x5910
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
cmpl $0x0, -0x3f0(%rbp)
jne 0xa6fb
cmpl $0x0, -0x3ec(%rbp)
jne 0xa6fb
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movl 0x8(%rcx), %ecx
imulq $0x6, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x2(%rax)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movl 0x8(%rcx), %ecx
imulq $0x6, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x3(%rax)
jmp 0xa73f
movq -0x3e8(%rbp), %rax
movb 0x3(%rax), %cl
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rdx
movl 0x8(%rdx), %edx
imulq $0x6, %rdx, %rdx
addq %rdx, %rax
movb %cl, 0x2(%rax)
movq -0x3e8(%rbp), %rax
movb 0x4(%rax), %cl
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rdx
movl 0x8(%rdx), %edx
imulq $0x6, %rdx, %rdx
addq %rdx, %rax
movb %cl, 0x3(%rax)
movw -0x404(%rbp), %cx
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rdx
movl 0x8(%rdx), %edx
imulq $0x6, %rdx, %rdx
addq %rdx, %rax
movw %cx, (%rax)
cmpl $0x4, -0x3ec(%rbp)
jne 0xa7ad
movq -0x3e8(%rbp), %rax
movb 0x15(%rax), %cl
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rdx
movl 0x8(%rdx), %edx
imulq $0x6, %rdx, %rdx
addq %rdx, %rax
movb %cl, 0x4(%rax)
movq -0x3e8(%rbp), %rax
movb 0x16(%rax), %cl
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rdx
movl 0x8(%rdx), %edx
imulq $0x6, %rdx, %rdx
addq %rdx, %rax
movb %cl, 0x5(%rax)
jmp 0xa7df
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movl 0x8(%rcx), %ecx
imulq $0x6, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x4(%rax)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movl 0x8(%rcx), %ecx
imulq $0x6, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x5(%rax)
movq -0x30(%rbp), %rax
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x8(%rax)
cmpl $0x0, -0x3f0(%rbp)
jne 0xa802
cmpl $0x0, -0x3ec(%rbp)
je 0xabb4
movq -0x400(%rbp), %rdi
callq 0x5650
movq %rax, -0x410(%rbp)
movq -0x3e8(%rbp), %rax
movb 0x3(%rax), %al
movb %al, -0x411(%rbp)
movq -0x3e8(%rbp), %rax
movb 0x4(%rax), %al
movb %al, -0x412(%rbp)
movzbl -0x411(%rbp), %eax
cmpl $0x12, %eax
jne 0xa860
movzbl -0x412(%rbp), %eax
cmpl $0x0, %eax
je 0xa859
movzbl -0x412(%rbp), %eax
cmpl $0x1, %eax
jne 0xa860
movb $0x0, -0x411(%rbp)
movl $0x0, -0x418(%rbp)
cmpb $0x0, -0x411(%rbp)
je 0xabb2
movzbl -0x411(%rbp), %eax
movzbl -0x43(%rbp), %ecx
cmpl %ecx, %eax
jle 0xa8e0
movzbl -0x411(%rbp), %edx
movl $0x1, %edi
leaq 0x9453(%rip), %rsi      # 0x13cec
movb $0x0, %al
callq 0x5ab0
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0xa8b5
jmp 0xabb6
movq -0x400(%rbp), %rdi
callq 0x50e0
movq $0x0, -0x400(%rbp)
movq $0x0, -0x50(%rbp)
movl $0xffffffff, -0x40(%rbp) # imm = 0xFFFFFFFF
jmp 0xabb2
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0xa948
movzbl -0x411(%rbp), %eax
cmpl $0x12, %eax
jne 0xa948
movl $0x1, %edi
leaq 0x940d(%rip), %rsi      # 0x13d13
callq 0x5a60
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
jne 0xa946
movq -0x400(%rbp), %rdi
callq 0x50e0
movq $0x0, -0x400(%rbp)
movq $0x0, -0x50(%rbp)
movl $0xffffffff, -0x40(%rbp) # imm = 0xFFFFFFFF
jmp 0xabb2
jmp 0xa948
movq -0x18(%rbp), %rdi
movb -0x411(%rbp), %al
movzbl %al, %esi
movzbl -0x412(%rbp), %edx
callq 0x50c0
movq %rax, -0x420(%rbp)
cmpq $0x0, -0x420(%rbp)
jne 0xa9c3
movl $0x1, %edi
leaq 0x93d0(%rip), %rsi      # 0x13d4e
callq 0x5a60
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0xa998
jmp 0xabb6
movq -0x400(%rbp), %rdi
callq 0x50e0
movq $0x0, -0x400(%rbp)
movq $0x0, -0x50(%rbp)
movl $0xffffffff, -0x40(%rbp) # imm = 0xFFFFFFFF
jmp 0xabb2
movzbl -0x411(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rcx
leaq -0x3d0(%rbp), %rax
imulq $0x15, %rcx, %rcx
addq %rcx, %rax
movzbl -0x412(%rbp), %ecx
cmpb $0x0, (%rax,%rcx)
je 0xaa3c
movl $0x1, %edi
leaq 0x9357(%rip), %rsi      # 0x13d4e
callq 0x5a60
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0xaa11
jmp 0xabb6
movq -0x400(%rbp), %rdi
callq 0x50e0
movq $0x0, -0x400(%rbp)
movq $0x0, -0x50(%rbp)
movl $0xffffffff, -0x40(%rbp) # imm = 0xFFFFFFFF
jmp 0xabb2
movzbl -0x411(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rcx
leaq -0x3d0(%rbp), %rax
imulq $0x15, %rcx, %rcx
addq %rcx, %rax
movzbl -0x412(%rbp), %ecx
movb $0x1, (%rax,%rcx)
movzbl -0x411(%rbp), %eax
cmpl $0x28, %eax
jle 0xaa98
cmpq $0x0, -0x28(%rbp)
je 0xaa98
movq -0x28(%rbp), %rax
movzbl -0x411(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x15, %rcx, %rcx
addq %rcx, %rax
movzbl -0x412(%rbp), %ecx
movb $0x1, (%rax,%rcx)
movq -0x18(%rbp), %rdi
movb -0x411(%rbp), %al
movzbl %al, %esi
movzbl -0x412(%rbp), %edx
callq 0x50c0
movq %rax, %rdi
callq 0x56d0
movq %rax, -0x428(%rbp)
movq -0x428(%rbp), %rax
movb (%rax), %al
movb %al, -0x411(%rbp)
movq -0x428(%rbp), %rax
movb 0x1(%rax), %al
movb %al, -0x412(%rbp)
cmpl $0x0, -0x418(%rbp)
jne 0xabad
movq $0xfe, -0x430(%rbp)
cmpb $0x0, -0x411(%rbp)
jne 0xab13
movzbl -0x412(%rbp), %eax
subl $0x1, %eax
cltq
movq %rax, -0x430(%rbp)
movq -0x410(%rbp), %rdi
movq -0x428(%rbp), %rsi
addq $0x2, %rsi
movq -0x430(%rbp), %rdx
callq 0x5790
cmpl $0x0, %eax
jge 0xab6f
movl $0x1, %edi
leaq 0x922f(%rip), %rsi      # 0x13d71
callq 0x5a60
movq -0x400(%rbp), %rdi
callq 0x50e0
movq $0x0, -0x400(%rbp)
movq $0x0, -0x50(%rbp)
movl $0xffffffff, -0x40(%rbp) # imm = 0xFFFFFFFF
jmp 0xabb2
cmpb $0x0, -0x411(%rbp)
jne 0xabab
cmpl $0x4, -0x3ec(%rbp)
jne 0xabab
movl $0x1, -0x418(%rbp)
movq -0x3e8(%rbp), %rax
movb 0x15(%rax), %al
movb %al, -0x411(%rbp)
movq -0x3e8(%rbp), %rax
movb 0x16(%rax), %al
movb %al, -0x412(%rbp)
jmp 0xabad
jmp 0xa86a
jmp 0xabb4
jmp 0xabb6
cmpq $0x0, -0x400(%rbp)
je 0xabff
movq -0x400(%rbp), %rdi
callq 0x56e0
movzwl %ax, %eax
movzwl -0x404(%rbp), %ecx
cmpl %ecx, %eax
je 0xabed
movq -0x400(%rbp), %rdi
movzwl -0x404(%rbp), %esi
callq 0x5280
movq -0x10(%rbp), %rdi
movq -0x400(%rbp), %rsi
callq 0x5500
jmp 0xac15
cmpq $0x0, -0x30(%rbp)
je 0xac13
movq -0x30(%rbp), %rax
movl 0x8(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x8(%rax)
jmp 0xac15
jmp 0xac17
jmp 0xac19
movb -0x3d9(%rbp), %al
addb $0x1, %al
movb %al, -0x3d9(%rbp)
jmp 0xa432
cmpq $0x0, -0x50(%rbp)
je 0xae2f
movq -0x3d8(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
je 0xae2f
movq -0x18(%rbp), %rdi
movq -0x3d8(%rbp), %rax
movb (%rax), %cl
movq -0x3d8(%rbp), %rax
movzbl %cl, %esi
movzbl 0x1(%rax), %edx
callq 0x50c0
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0xaca7
movl $0x1, %edi
leaq 0x90cd(%rip), %rsi      # 0x13d4e
callq 0x5a60
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0xac9b
jmp 0xae3e
movl $0xffffffff, -0x40(%rbp) # imm = 0xFFFFFFFF
jmp 0xadb8
movq -0x3d8(%rbp), %rax
movzbl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rcx
leaq -0x3d0(%rbp), %rax
imulq $0x15, %rcx, %rcx
addq %rcx, %rax
movq -0x3d8(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
cmpb $0x0, (%rax,%rcx)
je 0xad0b
movl $0x1, %edi
leaq 0x906c(%rip), %rsi      # 0x13d4e
callq 0x5a60
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
jne 0xad06
movl $0xffffffff, -0x40(%rbp) # imm = 0xFFFFFFFF
movq $0x0, -0x50(%rbp)
jmp 0xadb6
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0xad5f
movq -0x3d8(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x12, %eax
je 0xad5f
movl $0x1, %edi
leaq 0x9065(%rip), %rsi      # 0x13d99
callq 0x5a60
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0xad4e
jmp 0xae3e
movl $0xffffffff, -0x40(%rbp) # imm = 0xFFFFFFFF
movq $0x0, -0x50(%rbp)
jmp 0xadb4
movq -0x3d8(%rbp), %rax
movzbl (%rax), %eax
movzbl -0x43(%rbp), %ecx
cmpl %ecx, %eax
jle 0xadb2
movq -0x3d8(%rbp), %rax
movzbl (%rax), %edx
movl $0x1, %edi
leaq 0x8f65(%rip), %rsi      # 0x13cec
movb $0x0, %al
callq 0x5ab0
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0xada3
jmp 0xae3e
movl $0xffffffff, -0x40(%rbp) # imm = 0xFFFFFFFF
movq $0x0, -0x50(%rbp)
jmp 0xadb4
jmp 0xadb6
jmp 0xadb8
cmpl $0x0, -0x40(%rbp)
jne 0xae2d
movq -0x3d8(%rbp), %rax
movzbl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rcx
leaq -0x3d0(%rbp), %rax
imulq $0x15, %rcx, %rcx
addq %rcx, %rax
movq -0x3d8(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
movb $0x1, (%rax,%rcx)
movq -0x3d8(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x28, %eax
jle 0xae2b
cmpq $0x0, -0x28(%rbp)
je 0xae2b
movq -0x28(%rbp), %rax
movq -0x3d8(%rbp), %rcx
movzbl (%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x15, %rcx, %rcx
addq %rcx, %rax
movq -0x3d8(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
movb $0x1, (%rax,%rcx)
jmp 0xae2d
jmp 0xae37
movq $0x0, -0x50(%rbp)
jmp 0xa410
jmp 0xae3e
cmpl $0x0, -0x40(%rbp)
jne 0xaef5
cmpq $0x0, -0x28(%rbp)
je 0xaef5
movb $0x0, -0x431(%rbp)
movzbl -0x431(%rbp), %eax
movzbl -0x43(%rbp), %ecx
cmpl %ecx, %eax
jge 0xaef3
movb $0x0, -0x432(%rbp)
movzbl -0x432(%rbp), %eax
cmpl $0x15, %eax
jge 0xaede
movq -0x28(%rbp), %rax
movzbl -0x431(%rbp), %ecx
imulq $0x15, %rcx, %rcx
addq %rcx, %rax
movzbl -0x432(%rbp), %ecx
movzbl (%rax,%rcx), %eax
movzbl -0x431(%rbp), %ecx
movl %ecx, %edx
leaq -0x3d0(%rbp), %rcx
imulq $0x15, %rdx, %rdx
addq %rdx, %rcx
movzbl -0x432(%rbp), %edx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
je 0xaecc
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0xaefb
jmp 0xaece
movb -0x432(%rbp), %al
addb $0x1, %al
movb %al, -0x432(%rbp)
jmp 0xae74
jmp 0xaee0
movb -0x431(%rbp), %al
addb $0x1, %al
movb %al, -0x431(%rbp)
jmp 0xae5a
jmp 0xaef5
movl -0x40(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x450, %rsp            # imm = 0x450
popq %rbp
retq
nopw (%rax,%rax)