// File: /workspace/github_c_makefile_star2_O1/excess-c64[P]lib1541img/src/lib/1541img/cbmdosvfsreader.c
// Function: probeCbmdosFsOptions
SOEXPORT int probeCbmdosFsOptions(CbmdosFsOptions *options, const D64 *d64)
{
    CbmdosFsOptions probeopts = CFO_DEFAULT;
    if (options->flags & CFF_RECOVER)
    {
	probeopts.flags |= CFF_RECOVER;
    }

    uint8_t bamprobedolphin[5][21] = {{ 0 }};
    uint8_t bamprobespeed[5][21] = {{ 0 }};

    const uint8_t *bam = Sector_rcontent(D64_rsector(d64, 18, 0));
    if (D64_tracks(d64) > 35)
    {
	if (bam[2] == 0x50)
	{
	    probeopts.flags |= CFF_PROLOGICDOSBAM;
	    for (uint8_t trackno = 36; trackno < 41; ++trackno)
	    {
		uint8_t sectors = Track_sectors(D64_rtrack(d64, trackno));
		parseTrackBam(bamprobespeed[trackno-36],
			sectors, bam + 4*trackno);
	    }
	}
	else
	{
	    int dolphinok = 1;
	    int speedok = 1;
	    for (uint8_t trackno = 36; trackno < 41; ++trackno)
	    {
		uint8_t sectors = Track_sectors(D64_rtrack(d64, trackno));
		if (parseTrackBam(bamprobedolphin[trackno-36],
			    sectors, bam + 0x1c + 4*trackno) < 0)
		{
		    dolphinok = 0;
		}
		if (parseTrackBam(bamprobespeed[trackno-36],
			    sectors, bam + 0x30 + 4*trackno) < 0)
		{
		    speedok = 0;
		}
	    }
	    if (dolphinok)
	    {
		probeopts.flags |= CFF_DOLPHINDOSBAM;
	    }
	    if (speedok)
	    {
		probeopts.flags |= CFF_SPEEDDOSBAM;
	    }
	}
    }

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

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

    int firstfile = 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;
		if (type < CFT_DEL || type > CFT_REL)
		{
		    logmsg(L_ERROR, "probeCbmdosFsOptions: invalid file type "
			    "found.");
		    if (probeopts.flags & CFF_RECOVER) goto nextfile;
		    return -1;
		}
		if (type != CFT_DEL)
		{
		    uint8_t track = direntry[3];
		    uint8_t sector = direntry[4];
                    if (track == 18)
                    {
                        if (sector == 0 || sector == 1)
                        {
                            track = 0;
                        }
                        else if (firstfile)
                        {
                            probeopts.flags |= CFF_TALLOC_PREFDIRTRACK;
                        }
                    }
                    int doingsidesects = 0;
		    while (track)
		    {
			if (track > 40)
			{
			    probeopts.flags &= ~CFF_40TRACK;
			    probeopts.flags |= CFF_42TRACK;
			}
			else if (track > 35 && !(probeopts.flags & CFF_42TRACK))
			{
			    probeopts.flags |= CFF_40TRACK;
			}
			else if (track == 18)
			{
			    probeopts.flags |= CFF_FILESONDIRTRACK;
			}
			const Sector *filesector = D64_rsector(
				d64, track, sector);
			if (!filesector)
			{
			    logfmt(L_ERROR, "probeCbmdosFsOptions: "
				    "non-existent sector %d/%d found.",
				    track, sector);
			    if (probeopts.flags & CFF_RECOVER) goto nextfile;
			    return -1;
			}
                        if (rdmap[track-1][sector])
                        {
			    logmsg(L_ERROR, "probeCbmdosFsOptions: "
				    "corrupt filesystem, sector used twice.");
			    if (probeopts.flags & CFF_RECOVER) goto nextfile;
			    return -1;
                        }
                        rdmap[track-1][sector] = 1;
			const uint8_t *sectorbytes = Sector_rcontent(
				D64_rsector(d64, track, sector));
			track = sectorbytes[0];
			sector = sectorbytes[1];
                        if (!track && !doingsidesects && type == CFT_REL)
                        {
                            doingsidesects = 1;
                            track = direntry[0x15];
                            sector = direntry[0x16];
                        }
		    }
		}
nextfile:
		firstfile = 0;
            }
        }
        if (dirbytes[0])
        {
            dirsect = D64_rsector(d64, dirbytes[0], dirbytes[1]);
            if (!dirsect)
            {
                logfmt(L_ERROR, "probeCbmdosFsOptions: Non-existent sector "
			"%d/%d found.", dirbytes[0], dirbytes[1]);
		if (probeopts.flags & CFF_RECOVER) goto done;
		return -1;
            }
	    if (rdmap[dirbytes[0]-1][dirbytes[1]])
            {
                logmsg(L_ERROR, "probeCbmdosFsOptions: corrupt filesystem, "
			"sector used twice.");
                if (!(probeopts.flags & CFF_RECOVER)) return -1;
            }
	    if (dirbytes[0] > 40)
	    {
		probeopts.flags &= ~CFF_40TRACK;
		probeopts.flags |= CFF_42TRACK;
	    }
	    else if (dirbytes[0] > 35 && !(probeopts.flags & CFF_42TRACK))
	    {
		probeopts.flags |= CFF_40TRACK;
	    }
	    else if (dirbytes[0] != 18)
	    {
		probeopts.flags |= CFF_ALLOWLONGDIR;
	    }
	    rdmap[dirbytes[0]-1][dirbytes[1]] = 1;
        }
        else dirsect = 0;
    }

    if ((probeopts.flags & CFF_DOLPHINDOSBAM)
	    && memcmp(rdmap+35, bamprobedolphin, sizeof bamprobedolphin))
    {
	probeopts.flags &= ~CFF_DOLPHINDOSBAM;
    }
    if ((probeopts.flags & CFF_SPEEDDOSBAM)
	    && memcmp(rdmap+35, bamprobespeed, sizeof bamprobespeed))
    {
	probeopts.flags &= ~CFF_SPEEDDOSBAM;
    }
    if ((probeopts.flags & CFF_PROLOGICDOSBAM)
	    && memcmp(rdmap+35, bamprobespeed, sizeof bamprobespeed))
    {
	probeopts.flags &= ~CFF_PROLOGICDOSBAM;
    }

    int hasfreeblocks = 0;
    for (uint8_t trackno = 1;
	    trackno < (D64_type(d64) == D64_STANDARD ? 36 : 41); ++trackno)
    {
	uint8_t sectors = Track_sectors(D64_rtrack(d64, trackno));
	for (uint8_t sectno = 0; sectno < sectors; ++sectno)
	{
	    if (!rdmap[trackno-1][sectno])
	    {
		hasfreeblocks = 1;
		goto checkzerofree;
	    }
	}
    }

checkzerofree:
    if (hasfreeblocks)
    {
	int zerofree = 1;
	for (uint8_t trackno = 1; trackno < 36; ++trackno)
	{
	    if (bam[4*trackno])
	    {
		zerofree = 0;
		break;
	    }
	}

	if (D64_type(d64) == D64_STANDARD)
	{
	    if (zerofree) probeopts.flags |= CFF_ZEROFREE;
	}
	else if (zerofree)
	{
	    if (probeopts.flags & CFF_PROLOGICDOSBAM)
	    {
		for (uint8_t trackno = 36; trackno < 41; ++trackno)
		{
		    if (bam[4*trackno])
		    {
			zerofree = 0;
			break;
		    }
		}
		if (zerofree) probeopts.flags |= CFF_ZEROFREE;
	    }
	    else
	    {
		int havedolphin = 0;
		int havespeed = 0;
		if (!memcmp(rdmap+35, bamprobedolphin,
			sizeof bamprobedolphin))
		{
		    havedolphin = 1;
		    for (uint8_t trackno = 36; trackno < 41; ++trackno)
		    {
			if (bam[4*trackno + 0x1c])
			{
			    zerofree = 0;
			    break;
			}
		    }
		}
		if (!memcmp(rdmap+35, bamprobespeed,
			    sizeof bamprobespeed))
		{
		    havespeed = 1;
		    for (uint8_t trackno = 36; trackno < 41; ++trackno)
		    {
			if (bam[4*trackno + 0x30])
			{
			    zerofree = 0;
			    break;
			}
		    }
		}
		if (zerofree)
		{
		    probeopts.flags |= CFF_ZEROFREE;
		    if (havedolphin) probeopts.flags |= CFF_DOLPHINDOSBAM;
		    if (havespeed) probeopts.flags |= CFF_SPEEDDOSBAM;
		}
	    }
	}
    }

done:
    memcpy(options, &probeopts, sizeof probeopts);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4b8, %rsp            # imm = 0x4B8
movq %rdi, %rbx
movq 0xb345(%rip), %r13      # 0x12fe0
movl $0x100, %ebp            # imm = 0x100
andl (%rdi), %ebp
orl (%r13), %ebp
movq %rsi, %r15
xorps %xmm0, %xmm0
movups %xmm0, 0x129(%rsp)
movaps %xmm0, 0x120(%rsp)
movaps %xmm0, 0x110(%rsp)
movaps %xmm0, 0x100(%rsp)
movaps %xmm0, 0xf0(%rsp)
movaps %xmm0, 0xe0(%rsp)
movaps %xmm0, 0xd0(%rsp)
movups %xmm0, 0xb9(%rsp)
movaps %xmm0, 0xb0(%rsp)
movaps %xmm0, 0xa0(%rsp)
movaps %xmm0, 0x90(%rsp)
movaps %xmm0, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
movq %rsi, %rdi
movl $0x12, %esi
xorl %edx, %edx
callq 0x40c0
movq %rax, %rdi
callq 0x4670
movq %rax, %r14
movq %r15, 0x20(%rsp)
movq %r15, %rdi
callq 0x45f0
cmpb $0x24, %al
movq %rbx, 0x10(%rsp)
movq %r14, 0x40(%rsp)
jb 0x7e63
cmpb $0x50, 0x2(%r14)
jne 0x7dab
movq %r14, %rbx
addq $0x90, %rbx
movq $-0x5, %r15
leaq 0x60(%rsp), %r14
movq 0x20(%rsp), %r12
leal 0x29(%r15), %eax
movzbl %al, %esi
movq %r12, %rdi
callq 0x4060
movq %rax, %rdi
callq 0x4740
movzbl %al, %esi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x7bb6
addq $0x15, %r14
addq $0x4, %rbx
incq %r15
jne 0x7d71
orl $0x40, %ebp
jmp 0x7e63
movl %ebp, 0x1c(%rsp)
movq %r14, %rbx
addq $0xc0, %rbx
movl $0x1, 0xc(%rsp)
movq $-0x5, %r15
leaq 0xd0(%rsp), %r14
leaq 0x60(%rsp), %r12
movl $0x1, %r13d
leal 0x29(%r15), %eax
movzbl %al, %esi
movq 0x20(%rsp), %rdi
callq 0x4060
movq %rax, %rdi
callq 0x4740
leaq -0x14(%rbx), %rdx
movzbl %al, %ebp
movq %r14, %rdi
movl %ebp, %esi
callq 0x7bb6
testl %eax, %eax
movl 0xc(%rsp), %eax
movl $0x0, %ecx
cmovsl %ecx, %eax
movl %eax, 0xc(%rsp)
movq %r12, %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x7bb6
testl %eax, %eax
movl $0x0, %eax
cmovsl %eax, %r13d
addq $0x15, %r14
addq $0x15, %r12
addq $0x4, %rbx
incq %r15
jne 0x7ddb
movl 0x1c(%rsp), %ecx
movl %ecx, %eax
orl $0x10, %eax
cmpl $0x0, 0xc(%rsp)
cmovel %ecx, %eax
movl %eax, %ebp
orl $0x20, %ebp
testl %r13d, %r13d
cmovel %eax, %ebp
movq 0xb17d(%rip), %r13      # 0x12fe0
movl 0x4(%r13), %eax
movl %eax, 0x8(%rsp)
movq 0x20(%rsp), %r14
movq %r14, %rdi
movl $0x12, %esi
movl $0x1, %edx
callq 0x40c0
movq %rax, %r12
leaq 0x140(%rsp), %rbx
movl $0x372, %edx            # imm = 0x372
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4320
movw $0x101, 0x165(%rbx)     # imm = 0x101
movl $0x1, %r15d
testq %r12, %r12
je 0x81ec
movq %r12, 0x48(%rsp)
movq %r12, %rdi
callq 0x4670
movq %rax, %r13
xorl %edx, %edx
movq %rax, 0x30(%rsp)
movq %rdx, %rcx
shlq $0x5, %rcx
movb 0x2(%r13,%rcx), %al
testb %al, %al
je 0x80c4
andb $0xf, %al
cmpb $0x5, %al
jb 0x7f10
movl $0x1, %ebx
movl $0x1, %edi
leaq 0x5ea5(%rip), %rsi      # 0xdd9b
movq %rdx, %r12
callq 0x491c
movq %r12, %rdx
btl $0x8, %ebp
jb 0x80c1
jmp 0x80c6
testb %al, %al
je 0x80c1
movq %rdx, 0x38(%rsp)
movl %r15d, 0x2c(%rsp)
addq %r13, %rcx
movb 0x3(%rcx), %r13b
movb 0x4(%rcx), %dl
cmpb $0x12, %r13b
movb %al, 0x1c(%rsp)
jne 0x7f4f
cmpb $0x2, %dl
jae 0x7f40
xorl %r13d, %r13d
jmp 0x7f4f
movl %ebp, %eax
orl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, 0x2c(%rsp)
cmovnel %eax, %ebp
movq %rcx, 0x58(%rsp)
leaq 0x16(%rcx), %rax
movq %rax, 0x50(%rsp)
movl $0x0, 0xc(%rsp)
testb %r13b, %r13b
je 0x809b
cmpb $0x29, %r13b
jb 0x7f7c
andl $-0xd, %ebp
orl $0x8, %ebp
jmp 0x7f9a
cmpb $0x24, %r13b
jb 0x7f8e
movl %ebp, %eax
andl $0x8, %eax
jne 0x7f8e
orl $0x4, %ebp
jmp 0x7f9a
movl %ebp, %eax
orl $0x2, %eax
cmpb $0x12, %r13b
cmovel %eax, %ebp
movl %ebp, %r15d
movzbl %r13b, %ebx
movl %edx, %r12d
movzbl %dl, %ebp
movq %r14, %rdi
movl %ebx, %esi
movl %ebp, %edx
callq 0x40c0
testq %rax, %rax
je 0x7ffe
leal -0x1(%rbx), %eax
leaq (%rax,%rax,4), %rcx
leaq (%rax,%rcx,4), %rax
addq %rsp, %rax
addq $0x140, %rax            # imm = 0x140
cmpb $0x0, (%rbp,%rax)
je 0x8032
movl $0x1, %edi
leaq 0x5e22(%rip), %rsi      # 0xde01
callq 0x491c
movl %r15d, %ebp
btl $0x8, %r15d
movl $0xd, %ebx
movl $0x1, %eax
cmovael %eax, %ebx
xorl %r14d, %r14d
jmp 0x802d
xorl %r14d, %r14d
movl $0x1, %edi
leaq 0x5dbd(%rip), %rsi      # 0xddca
movl %ebx, %edx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x4949
movl %r15d, %ebp
btl $0x8, %r15d
movl $0xd, %ebx
movl $0x1, %eax
cmovael %eax, %ebx
movl %r12d, %edx
jmp 0x808b
addq %rbp, %rax
movb $0x1, (%rax)
movq %r14, %rdi
movl %ebx, %esi
movl %ebp, %edx
callq 0x40c0
movq %rax, %rdi
callq 0x4670
leaq 0x1(%rax), %rcx
movb (%rax), %r13b
cmpb $0x4, 0x1c(%rsp)
jne 0x8081
testb %r13b, %r13b
movq 0x58(%rsp), %rax
jne 0x8081
cmpl $0x0, 0xc(%rsp)
movl %r15d, %ebp
jne 0x8084
movb 0x15(%rax), %r13b
movl $0x1, 0xc(%rsp)
movq 0x50(%rsp), %rcx
jmp 0x8084
movl %r15d, %ebp
movb (%rcx), %dl
xorl %ebx, %ebx
movb $0x1, %r14b
testb %r14b, %r14b
movq 0x20(%rsp), %r14
jne 0x7f65
jmp 0x809d
xorl %ebx, %ebx
cmpl $0xd, %ebx
je 0x80b7
testl %ebx, %ebx
movl 0x2c(%rsp), %r15d
movq 0x30(%rsp), %r13
movq 0x38(%rsp), %rdx
je 0x80c1
jmp 0x80c6
movq 0x30(%rsp), %r13
movq 0x38(%rsp), %rdx
xorl %r15d, %r15d
xorl %ebx, %ebx
testl %ebx, %ebx
jne 0x80dc
incq %rdx
cmpq $0x8, %rdx
jne 0x7ecb
movl $0xa, %ebx
cmpl $0xa, %ebx
jne 0x8149
movb (%r13), %al
xorl %ebx, %ebx
testb %al, %al
je 0x818c
movzbl 0x1(%r13), %edx
movzbl %al, %esi
movq %r14, %rdi
callq 0x40c0
movzbl (%r13), %edx
testq %rax, %rax
je 0x8163
movq %rax, %r12
movl %edx, %eax
leaq (%rax,%rax,4), %rcx
leaq (%rax,%rcx,4), %rax
movzbl 0x1(%r13), %ecx
addq %rsp, %rax
addq $0x140, %rax            # imm = 0x140
cmpb $0x0, -0x15(%rcx,%rax)
je 0x8150
movl $0x1, %edi
leaq 0x5cca(%rip), %rsi      # 0xde01
callq 0x491c
btl $0x8, %ebp
jb 0x8150
movl $0x1, %ebx
jmp 0x81c6
movq 0x48(%rsp), %r12
jmp 0x81c6
movzbl (%r13), %eax
cmpq $0x29, %rax
jb 0x8191
andl $-0xd, %ebp
orl $0x8, %ebp
jmp 0x81ab
movzbl 0x1(%r13), %ecx
movl $0x1, %edi
leaq 0x5cca(%rip), %rsi      # 0xde3e
xorl %eax, %eax
callq 0x4949
btl $0x8, %ebp
movl $0x10, %ebx
movl $0x1, %eax
cmovael %eax, %ebx
xorl %r12d, %r12d
jmp 0x81c6
cmpb $0x24, %al
jb 0x81a1
movl %ebp, %ecx
andl $0x8, %ecx
jne 0x81a1
orl $0x4, %ebp
jmp 0x81ab
xorl %ecx, %ecx
cmpl $0x12, %eax
setne %cl
orl %ecx, %ebp
leaq (%rax,%rax,4), %rcx
leaq (%rax,%rcx,4), %rax
movzbl 0x1(%r13), %ecx
addq %rsp, %rax
addq $0x140, %rax            # imm = 0x140
movb $0x1, -0x15(%rcx,%rax)
testl %ebx, %ebx
je 0x7eab
cmpl $0x10, %ebx
jne 0x83eb
movq 0x10(%rsp), %rdx
movl 0x8(%rsp), %eax
movl %ebp, (%rdx)
movl %eax, 0x4(%rdx)
xorl %eax, %eax
jmp 0x83f0
testb $0x10, %bpl
je 0x8216
leaq 0x41f(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
movl $0x69, %edx
callq 0x4540
movl %ebp, %ecx
andl $-0x11, %ecx
testl %eax, %eax
cmovnel %ecx, %ebp
testb $0x20, %bpl
je 0x823d
leaq 0x41f(%rsp), %rdi
leaq 0x60(%rsp), %rsi
movl $0x69, %edx
callq 0x4540
movl %ebp, %ecx
andl $-0x21, %ecx
testl %eax, %eax
cmovnel %ecx, %ebp
testb $0x40, %bpl
je 0x8264
leaq 0x41f(%rsp), %rdi
leaq 0x60(%rsp), %rsi
movl $0x69, %edx
callq 0x4540
movl %ebp, %ecx
andl $-0x41, %ecx
testl %eax, %eax
cmovnel %ecx, %ebp
movl %ebp, %r15d
movq %r14, %rdi
callq 0x4430
movq %r14, %r12
movl $0x1, %r14d
xorl %ebp, %ebp
xorl %ebx, %ebx
movzbl %r14b, %esi
movq %r12, %rdi
callq 0x4060
movq %rax, %rdi
callq 0x4740
testb %al, %al
setne %dl
je 0x82ec
movl %r14d, %ecx
decl %ecx
movslq %ecx, %rcx
leaq (%rcx,%rcx,4), %rsi
leaq (%rcx,%rsi,4), %rcx
cmpb $0x0, 0x140(%rsp,%rcx)
je 0x82f0
movslq %ebp, %rcx
leaq (%rcx,%rcx,4), %rdx
leaq (%rcx,%rdx,4), %rcx
addq %rsp, %rcx
addq $0x140, %rcx            # imm = 0x140
movzbl %al, %esi
movl $0x1, %edi
movq %rdi, %rdx
cmpb %dl, %sil
je 0x82fc
leaq 0x1(%rdx), %rdi
cmpb $0x0, (%rcx,%rdx)
jne 0x82ce
movl $0x1, %ebx
movl $0x17, %ecx
jmp 0x82fe
xorl %ecx, %ecx
jmp 0x8303
movl $0x1, %ebx
movl $0x17, %ecx
jmp 0x8303
xorl %ecx, %ecx
cmpb %al, %dl
setb %dl
testb %dl, %dl
jne 0x8339
leal 0x1(%r14), %eax
movzbl %al, %r14d
movq 0x20(%rsp), %r12
movq %r12, %rdi
callq 0x4430
xorl %ecx, %ecx
testl %eax, %eax
setne %cl
leal (%rcx,%rcx,4), %eax
addl $0x24, %eax
incl %ebp
cmpl %r14d, %eax
ja 0x827c
movl $0x11, %ecx
cmpl $0x17, %ecx
je 0x834c
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0x11, %ecx
jne 0x83f0
testl %ebx, %ebx
je 0x84b4
movb $0x1, %bl
movq 0x40(%rsp), %r12
cmpb $0x0, 0x4(%r12)
movl %r15d, %ebp
movq 0x20(%rsp), %rdi
jne 0x838e
movl $0x2, %ecx
movq %rcx, %rax
cmpq $0x24, %rcx
je 0x8384
leaq 0x1(%rax), %rcx
cmpb $0x0, (%r12,%rax,4)
je 0x8370
decq %rax
cmpq $0x23, %rax
setb %bl
callq 0x4430
testl %eax, %eax
je 0x8402
testb %bl, %bl
jne 0x81d7
testb $0x40, %bpl
jne 0x8413
leaq 0x41f(%rsp), %r14
leaq 0xd0(%rsp), %rsi
movl $0x69, %edx
movq %r14, %rdi
callq 0x4540
movl %eax, %ebx
movl $0x1, %ebp
testl %eax, %eax
jne 0x845a
xorl %eax, %eax
movq %r12, %rcx
cmpb $0x0, 0xac(%rcx,%rax,4)
jne 0x8458
incq %rax
cmpq $0x5, %rax
jne 0x83d6
jmp 0x845a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x4b8, %rsp            # imm = 0x4B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %ebp, %eax
orl $0x80, %eax
testb %bl, %bl
cmovel %eax, %ebp
jmp 0x81d7
movb $0x1, %al
cmpb $0x0, 0x90(%r12)
movq 0x10(%rsp), %rdx
jne 0x8446
movl $0x24, %ecx
movq %rcx, %rax
cmpq $0x28, %rcx
je 0x843f
leaq 0x1(%rax), %rcx
cmpb $0x0, 0x4(%r12,%rax,4)
je 0x842a
cmpq $0x28, %rax
setb %al
movl %ebp, %ecx
orl $0x80, %ecx
testb %al, %al
cmovel %ecx, %ebp
jmp 0x81dc
xorl %ebp, %ebp
leaq 0x60(%rsp), %rsi
movl $0x69, %edx
movq %r14, %rdi
callq 0x4540
testl %eax, %eax
jne 0x848a
xorl %ecx, %ecx
cmpb $0x0, 0xc0(%r12,%rcx,4)
jne 0x8488
incq %rcx
cmpq $0x5, %rcx
jne 0x8472
jmp 0x848a
xorl %ebp, %ebp
testl %ebp, %ebp
je 0x84b4
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
xorl %eax, %eax
testl %ebx, %ebx
sete %al
shll $0x4, %eax
orl %r15d, %eax
shll $0x5, %ecx
orl %eax, %ecx
orl $0x80, %ecx
movl %ecx, %ebp
jmp 0x81d7
movq 0x10(%rsp), %rdx
movl %r15d, %ebp
jmp 0x81dc
nopl (%rax)