// File: /workspace/github_c_makefile_star2_O1/lb3361[P]dosfs/ff.c
// Function: mount_volume
static FRESULT mount_volume (	/* FR_OK(0): successful, !=0: an error occurred */
	const TCHAR** path,			/* Pointer to pointer to the path name (drive number) */
	FATFS** rfs,				/* Pointer to pointer to the found filesystem object */
	BYTE mode					/* !=0: Check write protection for write access */
)
{
	int vol;
	DSTATUS stat;
	LBA_t bsect;
	DWORD tsect, sysect, fasize, nclst, szbfat;
	WORD nrsv;
	FATFS *fs;
	UINT fmt;


	/* Get logical drive number */
	*rfs = 0;
	vol = get_ldnumber(path);
	if (vol < 0) return FR_INVALID_DRIVE;

	/* Check if the filesystem object is valid or not */
	fs = FatFs[vol];					/* Get pointer to the filesystem object */
	if (!fs) return FR_NOT_ENABLED;		/* Is the filesystem object available? */
#if FF_FS_REENTRANT
	if (!lock_fs(fs)) return FR_TIMEOUT;	/* Lock the volume */
#endif
	*rfs = fs;							/* Return pointer to the filesystem object */

	mode &= (BYTE)~FA_READ;				/* Desired access mode, write access or not */
	if (fs->fs_type != 0) {				/* If the volume has been mounted */
		stat = disk_status(fs->pdrv);
		if (!(stat & STA_NOINIT)) {		/* and the physical drive is kept initialized */
			if (!FF_FS_READONLY && mode && (stat & STA_PROTECT)) {	/* Check write protection if needed */
				return FR_WRITE_PROTECTED;
			}
			return FR_OK;				/* The filesystem object is already valid */
		}
	}

	/* The filesystem object is not valid. */
	/* Following code attempts to mount the volume. (find a FAT volume, analyze the BPB and initialize the filesystem object) */

	fs->fs_type = 0;					/* Clear the filesystem object */
	fs->pdrv = LD2PD(vol);				/* Volume hosting physical drive */
	stat = disk_initialize(fs->pdrv);	/* Initialize the physical drive */
	if (stat & STA_NOINIT) { 			/* Check if the initialization succeeded */
		return FR_NOT_READY;			/* Failed to initialize due to no medium or hard error */
	}
	if (!FF_FS_READONLY && mode && (stat & STA_PROTECT)) { /* Check disk write protection if needed */
		return FR_WRITE_PROTECTED;
	}
#if FF_MAX_SS != FF_MIN_SS				/* Get sector size (multiple sector size cfg only) */
	if (disk_ioctl(fs->pdrv, GET_SECTOR_SIZE, &SS(fs)) != RES_OK) return FR_DISK_ERR;
	if (SS(fs) > FF_MAX_SS || SS(fs) < FF_MIN_SS || (SS(fs) & (SS(fs) - 1))) return FR_DISK_ERR;
#endif

	/* Find an FAT volume on the drive */
	fmt = find_volume(fs, LD2PT(vol));
	if (fmt == 4) return FR_DISK_ERR;		/* An error occured in the disk I/O layer */
	if (fmt >= 2) return FR_NO_FILESYSTEM;	/* No FAT volume is found */
	bsect = fs->winsect;					/* Volume location */

	/* An FAT volume is found (bsect). Following code initializes the filesystem object */

#if FF_FS_EXFAT
	if (fmt == 1) {
		QWORD maxlba;
		DWORD so, cv, bcl, i;

		for (i = BPB_ZeroedEx; i < BPB_ZeroedEx + 53 && fs->win[i] == 0; i++) ;	/* Check zero filler */
		if (i < BPB_ZeroedEx + 53) return FR_NO_FILESYSTEM;

		if (ld_word(fs->win + BPB_FSVerEx) != 0x100) return FR_NO_FILESYSTEM;	/* Check exFAT version (must be version 1.0) */

		if (1 << fs->win[BPB_BytsPerSecEx] != SS(fs)) {	/* (BPB_BytsPerSecEx must be equal to the physical sector size) */
			return FR_NO_FILESYSTEM;
		}

		maxlba = ld_qword(fs->win + BPB_TotSecEx) + bsect;	/* Last LBA + 1 of the volume */
		if (!FF_LBA64 && maxlba >= 0x100000000) return FR_NO_FILESYSTEM;	/* (It cannot be handled in 32-bit LBA) */

		fs->fsize = ld_dword(fs->win + BPB_FatSzEx);	/* Number of sectors per FAT */

		fs->n_fats = fs->win[BPB_NumFATsEx];			/* Number of FATs */
		if (fs->n_fats != 1) return FR_NO_FILESYSTEM;	/* (Supports only 1 FAT) */

		fs->csize = 1 << fs->win[BPB_SecPerClusEx];		/* Cluster size */
		if (fs->csize == 0)	return FR_NO_FILESYSTEM;	/* (Must be 1..32768) */

		nclst = ld_dword(fs->win + BPB_NumClusEx);		/* Number of clusters */
		if (nclst > MAX_EXFAT) return FR_NO_FILESYSTEM;	/* (Too many clusters) */
		fs->n_fatent = nclst + 2;

		/* Boundaries and Limits */
		fs->volbase = bsect;
		fs->database = bsect + ld_dword(fs->win + BPB_DataOfsEx);
		fs->fatbase = bsect + ld_dword(fs->win + BPB_FatOfsEx);
		if (maxlba < (QWORD)fs->database + nclst * fs->csize) return FR_NO_FILESYSTEM;	/* (Volume size must not be smaller than the size requiered) */
		fs->dirbase = ld_dword(fs->win + BPB_RootClusEx);

		/* Get bitmap location and check if it is contiguous (implementation assumption) */
		so = i = 0;
		for (;;) {	/* Find the bitmap entry in the root directory (in only first cluster) */
			if (i == 0) {
				if (so >= fs->csize) return FR_NO_FILESYSTEM;	/* Not found? */
				if (move_window(fs, clst2sect(fs, (DWORD)fs->dirbase) + so) != FR_OK) return FR_DISK_ERR;
				so++;
			}
			if (fs->win[i] == ET_BITMAP) break;				/* Is it a bitmap entry? */
			i = (i + SZDIRE) % SS(fs);	/* Next entry */
		}
		bcl = ld_dword(fs->win + i + 20);					/* Bitmap cluster */
		if (bcl < 2 || bcl >= fs->n_fatent) return FR_NO_FILESYSTEM;
		fs->bitbase = fs->database + fs->csize * (bcl - 2);	/* Bitmap sector */
		for (;;) {	/* Check if bitmap is contiguous */
			if (move_window(fs, fs->fatbase + bcl / (SS(fs) / 4)) != FR_OK) return FR_DISK_ERR;
			cv = ld_dword(fs->win + bcl % (SS(fs) / 4) * 4);
			if (cv == 0xFFFFFFFF) break;				/* Last link? */
			if (cv != ++bcl) return FR_NO_FILESYSTEM;	/* Fragmented? */
		}

#if !FF_FS_READONLY
		fs->last_clst = fs->free_clst = 0xFFFFFFFF;		/* Initialize cluster allocation information */
#endif
		fmt = FS_EXFAT;			/* FAT sub-type */
	} else
#endif	/* FF_FS_EXFAT */
	{
		if (ld_word(fs->win + BPB_BytsPerSec) != SS(fs)) return FR_NO_FILESYSTEM;	/* (BPB_BytsPerSec must be equal to the physical sector size) */

		fasize = ld_word(fs->win + BPB_FATSz16);		/* Number of sectors per FAT */
		if (fasize == 0) fasize = ld_dword(fs->win + BPB_FATSz32);
		fs->fsize = fasize;

		fs->n_fats = fs->win[BPB_NumFATs];				/* Number of FATs */
		if (fs->n_fats != 1 && fs->n_fats != 2) return FR_NO_FILESYSTEM;	/* (Must be 1 or 2) */
		fasize *= fs->n_fats;							/* Number of sectors for FAT area */

		fs->csize = fs->win[BPB_SecPerClus];			/* Cluster size */
		if (fs->csize == 0 || (fs->csize & (fs->csize - 1))) return FR_NO_FILESYSTEM;	/* (Must be power of 2) */

		fs->n_rootdir = ld_word(fs->win + BPB_RootEntCnt);	/* Number of root directory entries */
		if (fs->n_rootdir % (SS(fs) / SZDIRE)) return FR_NO_FILESYSTEM;	/* (Must be sector aligned) */

		tsect = ld_word(fs->win + BPB_TotSec16);		/* Number of sectors on the volume */
		if (tsect == 0) tsect = ld_dword(fs->win + BPB_TotSec32);

		nrsv = ld_word(fs->win + BPB_RsvdSecCnt);		/* Number of reserved sectors */
		if (nrsv == 0) return FR_NO_FILESYSTEM;			/* (Must not be 0) */

		/* Determine the FAT sub type */
		sysect = nrsv + fasize + fs->n_rootdir / (SS(fs) / SZDIRE);	/* RSV + FAT + DIR */
		if (tsect < sysect) return FR_NO_FILESYSTEM;	/* (Invalid volume size) */
		nclst = (tsect - sysect) / fs->csize;			/* Number of clusters */
		if (nclst == 0) return FR_NO_FILESYSTEM;		/* (Invalid volume size) */
		fmt = 0;
		if (nclst <= MAX_FAT32) fmt = FS_FAT32;
		if (nclst <= MAX_FAT16) fmt = FS_FAT16;
		if (nclst <= MAX_FAT12) fmt = FS_FAT12;
		if (fmt == 0) return FR_NO_FILESYSTEM;

		/* Boundaries and Limits */
		fs->n_fatent = nclst + 2;						/* Number of FAT entries */
		fs->volbase = bsect;							/* Volume start sector */
		fs->fatbase = bsect + nrsv; 					/* FAT start sector */
		fs->database = bsect + sysect;					/* Data start sector */
		if (fmt == FS_FAT32) {
			if (ld_word(fs->win + BPB_FSVer32) != 0) return FR_NO_FILESYSTEM;	/* (Must be FAT32 revision 0.0) */
			if (fs->n_rootdir != 0) return FR_NO_FILESYSTEM;	/* (BPB_RootEntCnt must be 0) */
			fs->dirbase = ld_dword(fs->win + BPB_RootClus32);	/* Root directory start cluster */
			szbfat = fs->n_fatent * 4;					/* (Needed FAT size) */
		} else {
			if (fs->n_rootdir == 0)	return FR_NO_FILESYSTEM;	/* (BPB_RootEntCnt must not be 0) */
			fs->dirbase = fs->fatbase + fasize;			/* Root directory start sector */
			szbfat = (fmt == FS_FAT16) ?				/* (Needed FAT size) */
				fs->n_fatent * 2 : fs->n_fatent * 3 / 2 + (fs->n_fatent & 1);
		}
		if (fs->fsize < (szbfat + (SS(fs) - 1)) / SS(fs)) return FR_NO_FILESYSTEM;	/* (BPB_FATSz must not be less than the size needed) */

#if !FF_FS_READONLY
		/* Get FSInfo if available */
		fs->last_clst = fs->free_clst = 0xFFFFFFFF;		/* Initialize cluster allocation information */
		fs->fsi_flag = 0x80;
#if (FF_FS_NOFSINFO & 3) != 3
		if (fmt == FS_FAT32				/* Allow to update FSInfo only if BPB_FSInfo32 == 1 */
			&& ld_word(fs->win + BPB_FSInfo32) == 1
			&& move_window(fs, bsect + 1) == FR_OK)
		{
			fs->fsi_flag = 0;
			if (ld_word(fs->win + BS_55AA) == 0xAA55	/* Load FSInfo data if available */
				&& ld_dword(fs->win + FSI_LeadSig) == 0x41615252
				&& ld_dword(fs->win + FSI_StrucSig) == 0x61417272)
			{
#if (FF_FS_NOFSINFO & 1) == 0
				fs->free_clst = ld_dword(fs->win + FSI_Free_Count);
#endif
#if (FF_FS_NOFSINFO & 2) == 0
				fs->last_clst = ld_dword(fs->win + FSI_Nxt_Free);
#endif
			}
		}
#endif	/* (FF_FS_NOFSINFO & 3) != 3 */
#endif	/* !FF_FS_READONLY */
	}

	fs->fs_type = (BYTE)fmt;/* FAT sub-type */
	fs->id = ++Fsid;		/* Volume mount ID */
#if FF_USE_LFN == 1
	fs->lfnbuf = LfnBuf;	/* Static LFN working buffer */
#if FF_FS_EXFAT
	fs->dirbuf = DirBuf;	/* Static directory block scratchpad buuffer */
#endif
#endif
#if FF_FS_RPATH != 0
	fs->cdir = 0;			/* Initialize current directory */
#endif
#if FF_FS_LOCK != 0			/* Clear file lock semaphores */
	clear_lock(fs);
#endif
	return FR_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, %r14d
movq %rsi, %r15
movq $0x0, (%rsi)
callq 0x4c39
testl %eax, %eax
js 0x4cec
movl %eax, %r12d
leaq 0xc810(%rip), %rax      # 0x114c0
movq (%rax,%r12,8), %rbx
testq %rbx, %rbx
je 0x4d78
movq %rbx, (%r15)
cmpb $0x0, (%rbx)
je 0x4cf6
movzbl 0x1(%rbx), %edi
callq 0x2c38
testb $0x1, %al
jne 0x4cf6
movzbl %al, %eax
shll $0x1d, %eax
sarl $0x1f, %eax
andl $0xa, %eax
xorl %ebp, %ebp
testb $0x7e, %r14b
cmovnel %eax, %ebp
jmp 0x4d7d
movl $0xb, %ebp
jmp 0x4d7d
movb $0x0, (%rbx)
leaq 0xc55c(%rip), %r15      # 0x1125c
movzbl (%r15,%r12,2), %edi
movb %dil, 0x1(%rbx)
callq 0x2c58
movl $0x3, %ebp
testb $0x1, %al
jne 0x4d7d
testb $0x7e, %r14b
je 0x4d2a
movzbl %al, %eax
movl $0xa, %ebp
andl $0x4, %eax
jne 0x4d7d
movzbl 0x1(%r15,%r12,2), %ebp
movq %rbx, %rdi
xorl %esi, %esi
callq 0xb5a8
cmpl $0x2, %eax
je 0x4d50
testl %ebp, %ebp
je 0x4ef2
cmpl $0x2, %eax
ja 0x4ef2
cmpb $-0x12, 0x222(%rbx)
jne 0x4d8e
movl $0x1, %esi
movq %rbx, %rdi
callq 0x6314
testl %eax, %eax
je 0x4dfa
movl $0x4, %eax
jmp 0x4ef2
movl $0xc, %ebp
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x3, %eax
cmpb $0x4, %bpl
ja 0x4ef2
xorl %eax, %eax
movl 0x226(%rbx,%rax,4), %ecx
movl %ecx, 0x20(%rsp,%rax)
addq $0x4, %rax
cmpq $0x10, %rax
jne 0x4d9f
xorl %eax, %eax
movl %ebp, %r14d
subl $0x1, %r14d
cmovbl %eax, %r14d
movl 0x20(%rsp,%r14,4), %esi
testq %rsi, %rsi
je 0x4dd5
movq %rbx, %rdi
callq 0xb5a8
jmp 0x4dda
movl $0x3, %eax
cmpq $0x2, %r14
ja 0x4ef2
testb %bpl, %bpl
jne 0x4ef2
incq %r14
cmpl $0x1, %eax
ja 0x4dc1
jmp 0x4ef2
leaq 0x60(%rbx), %rdi
movq %rdi, 0x18(%rsp)
callq 0xad5e
testl %eax, %eax
je 0x4eed
movl 0xb0(%rbx), %r14d
leaq 0xa8(%rbx), %rdi
callq 0xaded
movq %rax, 0x10(%rsp)
movl %r14d, 0xc(%rsp)
testl %r14d, %r14d
je 0x4eed
xorl %r15d, %r15d
leaq 0x8670(%rip), %r13      # 0xd4b0
movl $0x0, 0x8(%rsp)
xorl %r14d, %r14d
movl %r14d, %r12d
shll $0x7, %r12d
movl %r12d, %esi
shrl $0x9, %esi
addq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x6314
testl %eax, %eax
jne 0x4d6e
movl %r15d, %eax
andl $0x180, %eax            # imm = 0x180
movq 0x18(%rsp), %rcx
addq %rcx, %rax
andl $0x180, %r12d           # imm = 0x180
addq %rcx, %r12
xorl %ecx, %ecx
movb (%rax,%rcx), %dl
movb (%rcx,%r13), %sil
cmpl $0xf, %ecx
je 0x4e9d
incq %rcx
cmpb %sil, %dl
je 0x4e89
cmpb %sil, %dl
jne 0x4edb
addq $0x20, %r12
movq %r12, %rdi
callq 0xaded
movq %rbx, %rdi
movq %rax, %rsi
callq 0xb5a8
testl %ebp, %ebp
jne 0x4ec2
cmpl $0x2, %eax
jb 0x4ef2
testb %bpl, %bpl
setne %cl
movl 0x8(%rsp), %edx
incl %edx
movl %edx, 0x8(%rsp)
cmpl %ebp, %edx
sete %dl
testb %dl, %cl
jne 0x4ef2
incl %r14d
subl $-0x80, %r15d
cmpl 0xc(%rsp), %r14d
jne 0x4e4b
movl $0x3, %eax
movl $0x1, %ebp
cmpl $0x4, %eax
je 0x4d7d
movl $0xd, %ebp
cmpl $0x1, %eax
ja 0x4d7d
movq 0x58(%rbx), %r14
jne 0x4fc4
movl $0x6b, %eax
movl $0x1, %r15d
cmpb $0x0, (%rbx,%rax)
jne 0x4f9a
incq %rax
cmpq $0xa0, %rax
jne 0x4f23
cmpw $0x100, 0xc8(%rbx)      # imm = 0x100
jne 0x4f9a
cmpb $0x9, 0xcc(%rbx)
jne 0x4f9a
leaq 0xa8(%rbx), %rdi
callq 0xaded
movl 0xb4(%rbx), %ecx
movl %ecx, 0x2c(%rbx)
movb 0xce(%rbx), %cl
movb %cl, 0x2(%rbx)
cmpb $0x1, %cl
jne 0x4f9a
movzbl 0xcd(%rbx), %ecx
movl $0x1, %edx
shll %cl, %edx
movl $0x1, %r15d
movw %dx, 0xa(%rbx)
cmpl $0xf, %ecx
ja 0x4f9a
movl 0xbc(%rbx), %edx
cmpl $0x7ffffffd, %edx       # imm = 0x7FFFFFFD
jbe 0x50f0
xorl %r14d, %r14d
testb %r14b, %r14b
je 0x4d7d
movb %r15b, (%rbx)
movzwl 0xc518(%rip), %eax      # 0x114c8
incl %eax
movw %ax, 0xc50f(%rip)       # 0x114c8
movw %ax, 0x6(%rbx)
xorl %ebp, %ebp
jmp 0x4d7d
cmpw $0x200, 0x6b(%rbx)      # imm = 0x200
jne 0x4d7d
movzwl 0x76(%rbx), %esi
testl %esi, %esi
jne 0x4fde
movl 0x84(%rbx), %esi
movl %esi, 0x2c(%rbx)
movzbl 0x70(%rbx), %edi
movb %dil, 0x2(%rbx)
leal -0x1(%rdi), %eax
cmpb $0x1, %al
ja 0x4d7d
movzbl 0x6d(%rbx), %eax
movw %ax, 0xa(%rbx)
leal -0x1(%rax), %ecx
movl %eax, %edx
xorb %cl, %dl
cmpb %cl, %dl
jbe 0x4d7d
movzbl 0x72(%rbx), %r8d
shll $0x8, %r8d
movzbl 0x71(%rbx), %ecx
orl %ecx, %r8d
movw %r8w, 0x8(%rbx)
testb $0xf, %cl
jne 0x4d7d
movzwl 0x73(%rbx), %ecx
testl %ecx, %ecx
jne 0x5037
movl 0x80(%rbx), %ecx
movzwl 0x6e(%rbx), %r9d
testl %r9d, %r9d
je 0x4d7d
imull %esi, %edi
movl %r8d, %r10d
shrl $0x4, %r10d
addl %edi, %r10d
addl %r9d, %r10d
subl %r10d, %ecx
jb 0x4d7d
movzwl %ax, %r11d
movl %ecx, %eax
xorl %edx, %edx
divl %r11d
cmpl %r11d, %ecx
jb 0x4d7d
xorl %ecx, %ecx
cmpl $0xffffff6, %eax        # imm = 0xFFFFFF6
setb %cl
leal (%rcx,%rcx,2), %ecx
cmpl $0xfff6, %eax           # imm = 0xFFF6
movl $0x2, %edx
cmovael %ecx, %edx
cmpl $0xff6, %eax            # imm = 0xFF6
movl $0x1, %r15d
cmovael %edx, %r15d
testl %r15d, %r15d
je 0x4d7d
leal 0x2(%rax), %ecx
movl %ecx, 0x28(%rbx)
movq %r14, 0x30(%rbx)
movzwl %r9w, %edx
addq %r14, %rdx
movq %rdx, 0x38(%rbx)
movl %r10d, %r9d
addq %r14, %r9
movq %r9, 0x48(%rbx)
cmpl $0x3, %r15d
jne 0x5231
movzwl 0x8a(%rbx), %eax
orw %r8w, %ax
jne 0x4d7d
movl 0x8c(%rbx), %eax
movq %rax, 0x40(%rbx)
shll $0x2, %ecx
jmp 0x5275
addq %r14, %rax
leal 0x2(%rdx), %esi
movl %esi, 0x28(%rbx)
movq %r14, 0x30(%rbx)
movl 0xb0(%rbx), %esi
movl 0xb8(%rbx), %edi
addq %r14, %rdi
movq %rdi, 0x48(%rbx)
addq %r14, %rsi
shll %cl, %edx
movq %rsi, 0x38(%rbx)
addq %rdi, %rdx
xorl %r14d, %r14d
cmpq %rdx, %rax
jb 0x4f9d
movl 0xc0(%rbx), %eax
movq %rax, 0x40(%rbx)
xorl %r12d, %r12d
testl %r12d, %r12d
jne 0x517e
movzwl 0xa(%rbx), %eax
cmpl %eax, %r14d
jae 0x4f9a
movl 0x28(%rbx), %edx
movl 0x40(%rbx), %ecx
addl $-0x2, %ecx
addl $-0x2, %edx
cmpl %edx, %ecx
jae 0x5163
movl %ecx, %ecx
imulq %rax, %rcx
addq 0x48(%rbx), %rcx
jmp 0x5165
xorl %ecx, %ecx
movl %r14d, %esi
addq %rcx, %rsi
movq %rbx, %rdi
callq 0x6314
testl %eax, %eax
jne 0x5256
incl %r14d
movl %r12d, %ecx
cmpb $-0x7f, 0x60(%rbx,%rcx)
je 0x5195
addl $0x20, %r12d
andl $0x1ff, %r12d           # imm = 0x1FF
jmp 0x5135
movzbl 0x77(%rbx,%rcx), %eax
movzbl 0x76(%rbx,%rcx), %edx
shll $0x10, %eax
shll $0x8, %edx
orl %eax, %edx
movzbl 0x75(%rbx,%rcx), %eax
orl %edx, %eax
movl %eax, %r12d
shll $0x8, %r12d
movzbl 0x74(%rbx,%rcx), %ecx
orl %ecx, %r12d
cmpl $0x2, %r12d
jb 0x4f9a
cmpl 0x28(%rbx), %r12d
jae 0x4f9a
movzwl 0xa(%rbx), %edx
leal -0x2(%r12), %esi
imull %edx, %esi
addq 0x48(%rbx), %rsi
movq %rsi, 0x50(%rbx)
shll $0xa, %eax
leal (%rax,%rcx,4), %r13d
movl $0x1, %r15d
movl %r12d, %esi
shrl $0x7, %esi
addq 0x38(%rbx), %rsi
movq %rbx, %rdi
callq 0x6314
testl %eax, %eax
jne 0x525c
movl %r13d, %eax
andl $0x1fc, %eax            # imm = 0x1FC
movl 0x60(%rbx,%rax), %eax
cmpl $-0x1, %eax
je 0x5304
incl %r12d
addl $0x4, %r13d
xorl %r14d, %r14d
cmpl %eax, %r12d
je 0x51f2
jmp 0x4f9d
testw %r8w, %r8w
je 0x4d7d
movl %edi, %edi
addq %rdi, %rdx
movq %rdx, 0x40(%rbx)
leal -0xff6(%rax), %edx
cmpl $0xefff, %edx           # imm = 0xEFFF
ja 0x5269
addl %ecx, %ecx
jmp 0x5275
movl $0x1, %r15d
xorl %r14d, %r14d
movl $0x1, %ebp
jmp 0x4f9d
leal (%rcx,%rcx,2), %ecx
shrl %ecx
andl $0x1, %eax
addl %ecx, %eax
movl %eax, %ecx
addl $0x1ff, %ecx            # imm = 0x1FF
shrl $0x9, %ecx
cmpl %ecx, %esi
jb 0x4d7d
movq $-0x1, 0x20(%rbx)
movb $-0x80, 0x4(%rbx)
cmpl $0x3, %r15d
jne 0x4fa6
movl $0x3, %r15d
cmpw $0x1, 0x90(%rbx)
jne 0x4fa6
incq %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6314
testl %eax, %eax
jne 0x4fa6
movb $0x0, 0x4(%rbx)
cmpw $0xaa55, 0x25e(%rbx)    # imm = 0xAA55
jne 0x4fa6
cmpl $0x41615252, 0x60(%rbx) # imm = 0x41615252
jne 0x4fa6
cmpl $0x61417272, 0x244(%rbx) # imm = 0x61417272
jne 0x4fa6
movl 0x24c(%rbx), %eax
movl %eax, 0x20(%rbx)
jmp 0x4fa6
movq $-0x1, 0x20(%rbx)
movb $0x1, %r14b
movl $0x4, %r15d
jmp 0x4f9d