// File: /workspace/github_c_makefile_star2_O1/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, %r14
movq %rcx, %rbx
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
callq 0x4240
testl %eax, %eax
je 0x7295
leaq 0x69fc(%rip), %rsi      # 0xdc70
movl $0x1, %edi
callq 0x491c
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x3e8, %rsp            # imm = 0x3E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, 0x20(%rsp)
movq %r12, %rdi
movl $0x12, %esi
xorl %edx, %edx
callq 0x40c0
movq %rax, %rdi
callq 0x4670
movq %rax, %rbx
movzbl 0x2(%rax), %esi
movq %r13, %rdi
callq 0x4600
movq %r15, 0x8(%rsp)
movb (%r15), %cl
leal (%rcx,%rcx), %eax
sarb $0x7, %al
andb $0x14, %al
leaq 0x14(%rbx), %rdx
testb $0x40, %cl
cmoveq %rbx, %rdx
addq $0x8f, %rdx
movb $0x10, %cl
movzbl %cl, %esi
cmpb $-0x60, (%rdx,%rsi)
jne 0x72f3
decb %cl
jne 0x72e4
xorl %ecx, %ecx
movq %r12, 0x40(%rsp)
movq %r14, 0x50(%rsp)
movzbl %al, %r14d
leaq (%rbx,%r14), %rsi
addq $0x90, %rsi
movzbl %cl, %edx
movq %r13, %rdi
callq 0x4510
movb 0xa6(%rbx,%r14), %cl
movb $0x5, %al
cmpb 0x2(%rbx), %cl
jne 0x735a
movb $0x4, %al
cmpb $0x32, 0xa5(%rbx,%r14)
jne 0x735a
movb $0x3, %al
cmpb $-0x60, 0xa4(%rbx,%r14)
jne 0x735a
movl %r14d, %ecx
movb $0x2, %al
cmpb $-0x60, 0xa3(%rbx,%rcx)
jne 0x735a
cmpb $-0x60, 0xa2(%rbx,%rcx)
setne %al
leaq (%rbx,%r14), %rsi
addq $0xa2, %rsi
movzbl %al, %edx
movq %r13, 0x60(%rsp)
movq %r13, %rdi
callq 0x4530
movl $0x0, 0x4(%rsp)
cmpq $0x0, 0x20(%rsp)
movq 0x40(%rsp), %rbp
je 0x7501
movq %rbp, %rdi
callq 0x45f0
movl $0x0, 0x4(%rsp)
testb %al, %al
je 0x7501
movq 0x20(%rsp), %rax
leaq -0x15(%rax), %r14
leaq 0x1c(%rbx), %rax
movq %rax, 0x48(%rsp)
leaq 0x30(%rbx), %rax
movq %rax, 0x38(%rsp)
movb $0x1, %r15b
movl $0x0, 0x4(%rsp)
movl $0x1, %r13d
movzbl %r15b, %r12d
movq %rbp, %rdi
movl %r12d, %esi
callq 0x4060
movq %rax, %rdi
callq 0x4740
movl %eax, %ebp
cmpb $0x23, %r12b
ja 0x7431
leaq (%r12,%r12,4), %rax
leaq (%r12,%rax,4), %rdi
addq %r14, %rdi
movl %r13d, %eax
leaq (%rbx,%rax,4), %rdx
movzbl %bpl, %esi
callq 0x7bb6
testl %eax, %eax
jns 0x74e4
movq 0x8(%rsp), %rax
testb $-0x80, (%rax)
movl 0x4(%rsp), %eax
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
cmovel %ecx, %eax
movl %eax, 0x4(%rsp)
jmp 0x74e4
movq 0x8(%rsp), %rax
movl (%rax), %eax
testb $0xc, %al
sete %cl
cmpb $0x29, %r15b
setae %dl
orb %cl, %dl
jne 0x74e4
testb $0x10, %al
je 0x7474
leaq (%r12,%r12,4), %rax
leaq (%r12,%rax,4), %rdi
addq %r14, %rdi
movl %r13d, %eax
movq 0x48(%rsp), %rcx
leaq (%rcx,%rax,4), %rdx
movzbl %bpl, %esi
callq 0x7bb6
testl %eax, %eax
js 0x74a9
movq 0x8(%rsp), %rax
testb $0x20, (%rax)
je 0x74db
leaq (%r12,%r12,4), %rax
leaq (%r12,%rax,4), %rdi
addq %r14, %rdi
movl %r13d, %eax
movq 0x38(%rsp), %rcx
leaq (%rcx,%rax,4), %rdx
movzbl %bpl, %esi
callq 0x7bb6
testl %eax, %eax
js 0x74c3
movq 0x8(%rsp), %rax
jmp 0x74db
movq 0x8(%rsp), %rax
testb $-0x80, (%rax)
movl 0x4(%rsp), %ecx
movl $0xfffffffe, %edx       # imm = 0xFFFFFFFE
cmovel %edx, %ecx
movl %ecx, 0x4(%rsp)
jmp 0x7479
movq 0x8(%rsp), %rax
testb $-0x80, (%rax)
movl 0x4(%rsp), %ecx
movl $0xfffffffe, %edx       # imm = 0xFFFFFFFE
cmovel %edx, %ecx
movl %ecx, 0x4(%rsp)
testb $0x40, (%rax)
jne 0x73f1
incb %r15b
movzbl %r15b, %r13d
movq 0x40(%rsp), %rbp
movq %rbp, %rdi
callq 0x45f0
cmpb %al, %r13b
jbe 0x73d2
movq 0x8(%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 0x40c0
movq %rax, %r14
leaq 0x70(%rsp), %rbx
movl $0x372, %edx            # imm = 0x372
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4320
movw $0x101, 0x165(%rbx)     # imm = 0x101
movq 0x50(%rsp), %r13
testq %r14, %r14
je 0x7b45
movq %r14, 0x30(%rsp)
movq %r14, %rdi
callq 0x4670
movq %rax, %r12
xorl %r15d, %r15d
movq %rax, 0x28(%rsp)
movq %r15, %r14
shlq $0x5, %r14
movzbl 0x2(%r12,%r14), %ebx
testl %ebx, %ebx
je 0x79a5
movq %r15, 0x58(%rsp)
movq %r13, %r15
movl %ebx, %r13d
andl $0xf, %r13d
callq 0x4390
movq %rax, %rbp
movq %rax, %rdi
movl %r13d, %esi
callq 0x4110
movl %eax, %r12d
testl %eax, %eax
jns 0x75c8
movq 0x8(%rsp), %rax
testb $0x1, 0x1(%rax)
je 0x76cc
addq 0x28(%rsp), %r14
movl %ebx, %esi
shrl $0x6, %esi
andl $0x1, %esi
shrb $0x7, %bl
movzbl %bl, %ebx
movq %rbp, %rdi
callq 0x43f0
movq %rbp, %rdi
movl %ebx, %esi
callq 0x46b0
movl %r13d, 0x18(%rsp)
cmpl $0x4, %r13d
jne 0x760d
movzbl 0x17(%r14), %esi
movq %rbp, %rdi
callq 0x4580
testl %eax, %eax
js 0x76cc
movb $0x10, %al
movq %r15, %r13
movq 0x58(%rsp), %r15
movzbl %al, %ecx
cmpb $-0x60, 0x4(%r14,%rcx)
jne 0x7628
decb %al
jne 0x7617
xorl %eax, %eax
leaq 0x5(%r14), %rsi
movzbl %al, %edx
movq %rbp, %rdi
callq 0x42f0
movq %rbp, %rdi
xorl %esi, %esi
callq 0x4360
movq %rax, %rbx
movq %rbp, %rdi
callq 0x4780
movl %eax, %edi
callq 0x46a0
movl $0x4, %edi
leaq 0x663b(%rip), %rsi      # 0xdc9a
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x4949
movzwl 0x1e(%r14), %edi
testq %r13, %r13
je 0x773a
movl 0xc(%r13), %eax
cmpl %eax, 0x8(%r13)
jne 0x76a5
addl $0x90, %eax
movl %eax, 0xc(%r13)
movl %edi, %ebx
movq (%r13), %rdi
addq %rax, %rax
leaq (%rax,%rax,2), %rsi
callq 0x487c
movl %ebx, %edi
movq %rax, (%r13)
testl %r12d, %r12d
sets %al
cmpl $0x0, 0x18(%rsp)
setne %cl
orb %al, %cl
jne 0x76e6
movq (%r13), %rax
movl 0x8(%r13), %ecx
leaq (%rcx,%rcx,2), %rcx
movw $0x0, 0x2(%rax,%rcx,2)
jmp 0x7702
movq %rbp, %rdi
callq 0x40e0
movq 0x28(%rsp), %r12
movq %r15, %r13
movq 0x58(%rsp), %r15
jmp 0x79a5
movb 0x3(%r14), %al
movq (%r13), %rcx
movl 0x8(%r13), %edx
leaq (%rdx,%rdx,2), %rdx
movb %al, 0x2(%rcx,%rdx,2)
movb 0x4(%r14), %al
movb %al, 0x3(%rcx,%rdx,2)
movq (%r13), %rcx
movl 0x8(%r13), %eax
leaq (%rax,%rax,2), %rdx
movw %di, (%rcx,%rdx,2)
cmpl $0x4, 0x18(%rsp)
jne 0x7728
movb 0x15(%r14), %sil
movb %sil, 0x4(%rcx,%rdx,2)
movb 0x16(%r14), %sil
jmp 0x772f
movb $0x0, 0x4(%rcx,%rdx,2)
xorl %esi, %esi
movb %sil, 0x5(%rcx,%rdx,2)
incl %eax
movl %eax, 0x8(%r13)
testl %r12d, %r12d
setns %al
cmpl $0x0, 0x18(%rsp)
sete %cl
testb %al, %cl
movw %di, 0x1e(%rsp)
jne 0x795c
movq %rbp, %rdi
callq 0x4610
movzbl 0x3(%r14), %ecx
movb 0x4(%r14), %dl
xorl %esi, %esi
movb %dl, 0x48(%rsp)
cmpb $0x2, %dl
movl %ecx, %r13d
movl $0x0, 0x14(%rsp)
cmovbl %esi, %r13d
movq %rax, 0x68(%rsp)
cmpb $0x12, %cl
cmovnel %ecx, %r13d
testb %r13b, %r13b
je 0x795c
movzbl %r13b, %r12d
cmpb 0x38(%rsp), %r13b
ja 0x7920
cmpb $0x12, %r13b
jne 0x77d4
movq 0x8(%rsp), %rax
movl (%rax), %eax
andl $0x2, %eax
jne 0x77d4
movl $0x1, %edi
leaq 0x6523(%rip), %rsi      # 0xdce3
callq 0x491c
movq 0x8(%rsp), %rax
testb $0x1, 0x1(%rax)
je 0x7941
movzbl 0x48(%rsp), %ebx
movq 0x40(%rsp), %rdi
movl %r12d, %esi
movl %ebx, %edx
callq 0x40c0
testq %rax, %rax
je 0x7808
leal -0x1(%r12), %eax
leaq (%rax,%rax,4), %rcx
leaq (%rax,%rcx,4), %rax
leaq (%rsp,%rax), %rcx
addq $0x70, %rcx
cmpb $0x0, (%rbx,%rcx)
je 0x784d
movl $0x1, %edi
leaq 0x650a(%rip), %rsi      # 0xdd1e
callq 0x491c
movq 0x8(%rsp), %rax
testb $0x1, 0x1(%rax)
jne 0x7846
movq %rbp, %rdi
callq 0x40e0
movl $0xffffffff, 0x4(%rsp)  # imm = 0xFFFFFFFF
xorl %ebx, %ebx
movq $0x0, 0x30(%rsp)
xorl %ebp, %ebp
jmp 0x7916
xorl %ebx, %ebx
jmp 0x7916
addq %rbx, %rcx
movb $0x1, (%rcx)
movq 0x20(%rsp), %rcx
testq %rcx, %rcx
je 0x786a
cmpb $0x29, %r13b
jb 0x786a
addq %rcx, %rax
movb $0x1, (%rbx,%rax)
movq 0x40(%rsp), %rdi
movl %r12d, %esi
movl %ebx, %edx
callq 0x40c0
movq %rax, %rdi
callq 0x4670
movb (%rax), %r13b
movb 0x1(%rax), %cl
movb $0x1, %bl
cmpl $0x0, 0x14(%rsp)
movb %cl, 0x48(%rsp)
je 0x789e
movl $0x1, 0x14(%rsp)
jmp 0x7916
movzbl %cl, %edx
decq %rdx
testb %r13b, %r13b
movl $0xfe, %ecx
cmovneq %rcx, %rdx
addq $0x2, %rax
movq 0x68(%rsp), %rdi
movq %rax, %rsi
callq 0x4720
testl %eax, %eax
setns %bl
js 0x78e2
cmpl $0x4, 0x18(%rsp)
jne 0x790e
testb %r13b, %r13b
jne 0x790e
movb 0x15(%r14), %r13b
movb 0x16(%r14), %al
movb %al, 0x48(%rsp)
jmp 0x7894
movl $0x1, %edi
leaq 0x6453(%rip), %rsi      # 0xdd41
callq 0x491c
movq %rbp, %rdi
callq 0x40e0
movq $0x0, 0x30(%rsp)
movl $0xffffffff, 0x4(%rsp)  # imm = 0xFFFFFFFF
xorl %ebp, %ebp
movl $0x0, 0x14(%rsp)
testb %bl, %bl
jne 0x778a
jmp 0x795c
movl $0x1, %edi
leaq 0x6390(%rip), %rsi      # 0xdcbc
movl %r12d, %edx
xorl %eax, %eax
callq 0x4949
movq 0x8(%rsp), %rax
testb $0x1, 0x1(%rax)
jne 0x795c
movq %rbp, %rdi
callq 0x40e0
movl $0xffffffff, 0x4(%rsp)  # imm = 0xFFFFFFFF
movq $0x0, 0x30(%rsp)
xorl %ebp, %ebp
testq %rbp, %rbp
je 0x7992
movq %rbp, %rdi
callq 0x4680
movzwl 0x1e(%rsp), %ecx
cmpw %cx, %ax
movq 0x50(%rsp), %r13
je 0x7983
movzwl %cx, %esi
movq %rbp, %rdi
callq 0x4260
movq 0x60(%rsp), %rdi
movq %rbp, %rsi
callq 0x44b0
jmp 0x79a0
movq 0x50(%rsp), %r13
testq %r13, %r13
je 0x79a0
decl 0x8(%r13)
movq 0x28(%rsp), %r12
incq %r15
cmpq $0x8, %r15
jne 0x757b
cmpq $0x0, 0x30(%rsp)
jne 0x79cc
xorl %eax, %eax
xorl %r14d, %r14d
testl %eax, %eax
je 0x755a
jmp 0x7b40
movb (%r12), %al
xorl %r14d, %r14d
testb %al, %al
je 0x7a49
movzbl 0x1(%r12), %edx
movzbl %al, %esi
movq 0x40(%rsp), %rdi
callq 0x40c0
testq %rax, %rax
je 0x7a50
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)
je 0x7a82
movl $0x1, %edi
leaq 0x62ff(%rip), %rsi      # 0xdd1e
callq 0x491c
movq 0x8(%rsp), %rax
movb 0x1(%rax), %al
andb $0x1, %al
movl $0x0, %ecx
cmoveq %rcx, %r14
cmpb $0x1, %al
movl $0x0, %ecx
sbbl %ecx, %ecx
orl 0x4(%rsp), %ecx
jmp 0x7ae1
xorl %eax, %eax
jmp 0x79bf
movl $0x1, %edi
leaq 0x62c2(%rip), %rsi      # 0xdd1e
callq 0x491c
movl $0x11, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq 0x8(%rsp), %rdx
testb $0x1, 0x1(%rdx)
movl $0x0, %r14d
jne 0x79bf
jmp 0x7ae1
cmpl $0x12, %edx
je 0x7aa6
movq 0x8(%rsp), %rax
movl (%rax), %eax
andl $0x1, %eax
jne 0x7aa6
movl $0x1, %edi
leaq 0x62ca(%rip), %rsi      # 0xdd69
callq 0x491c
jmp 0x7abf
cmpb 0x38(%rsp), %dl
jbe 0x7add
movl $0x1, %edi
leaq 0x6204(%rip), %rsi      # 0xdcbc
xorl %eax, %eax
callq 0x4949
movl $0x11, %eax
movq 0x8(%rsp), %rcx
testb $0x1, 0x1(%rcx)
jne 0x79bf
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
xorl %r14d, %r14d
jmp 0x7ae1
movl 0x4(%rsp), %ecx
xorl %eax, %eax
testl %ecx, %ecx
je 0x7af0
movl %ecx, 0x4(%rsp)
jmp 0x79bf
movb (%r12), %sil
movzbl %sil, %ecx
leaq (%rcx,%rcx,4), %rdx
leaq (%rcx,%rdx,4), %rdi
movzbl 0x1(%r12), %edx
addq %rsp, %rdi
addq $0x70, %rdi
movb $0x1, -0x15(%rdx,%rdi)
cmpq $0x0, 0x20(%rsp)
je 0x7b33
cmpb $0x29, %sil
jb 0x7b33
decl %ecx
leaq (%rcx,%rcx,4), %rsi
leaq (%rcx,%rsi,4), %rcx
addq 0x20(%rsp), %rcx
movb $0x1, (%rdx,%rcx)
movl $0x0, 0x4(%rsp)
jmp 0x79bf
cmpl $0x11, %eax
jne 0x7ba8
movq 0x20(%rsp), %rdx
testq %rdx, %rdx
je 0x7bad
movl 0x4(%rsp), %r8d
testl %r8d, %r8d
jne 0x7ba0
movb $0x1, %cl
xorl %eax, %eax
leaq 0x70(%rsp), %r9
movq %rdx, %rdi
xorl %edx, %edx
movb (%rdi,%rdx), %sil
cmpb (%r9,%rdx), %sil
jne 0x7b92
incq %rdx
cmpq $0x15, %rdx
jne 0x7b67
incb %al
movq %rdi, %rdx
addq $0x15, %rdx
addq $0x15, %r9
cmpb 0x38(%rsp), %al
setb %cl
jne 0x7b62
jmp 0x7ba0
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
testb $0x1, %cl
jne 0x7283
movl %r8d, %eax
jmp 0x7283
jmp 0x7283
movl 0x4(%rsp), %eax
jmp 0x7283