// File: /workspace/github_c_makefile_star2_O3/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 0x4a91
testl %eax, %eax
js 0x4b44
movl %eax, %r12d
leaq 0xc9b8(%rip), %rax      # 0x114c0
movq (%rax,%r12,8), %rbx
testq %rbx, %rbx
je 0x4bcd
movq %rbx, (%r15)
cmpb $0x0, (%rbx)
je 0x4b4e
movzbl 0x1(%rbx), %edi
callq 0x2c78
testb $0x1, %al
jne 0x4b4e
movzbl %al, %eax
shll $0x1d, %eax
sarl $0x1f, %eax
andl $0xa, %eax
xorl %ebp, %ebp
testb $0x7e, %r14b
cmovnel %eax, %ebp
jmp 0x4bd2
movl $0xb, %ebp
jmp 0x4bd2
movb $0x0, (%rbx)
leaq 0xc704(%rip), %r15      # 0x1125c
movzbl (%r15,%r12,2), %edi
movb %dil, 0x1(%rbx)
callq 0x2c98
movl $0x3, %ebp
testb $0x1, %al
jne 0x4bd2
testb $0x7e, %r14b
je 0x4b82
movzbl %al, %eax
movl $0xa, %ebp
andl $0x4, %eax
jne 0x4bd2
movzbl 0x1(%r15,%r12,2), %ebp
movq %rbx, %rdi
xorl %esi, %esi
callq 0xb22a
cmpl $0x2, %eax
je 0x4ba8
testl %ebp, %ebp
je 0x4c44
cmpl $0x2, %eax
ja 0x4c44
cmpb $-0x12, 0x222(%rbx)
jne 0x4be3
movl $0x1, %esi
movq %rbx, %rdi
callq 0x6114
testl %eax, %eax
je 0x4c53
movl $0x1, %ebp
jmp 0x4bd2
movl $0xc, %ebp
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x3, %ecx
cmpb $0x4, %bpl
ja 0x4d43
movl $0x8a, %eax
movl -0x2(%rbx,%rax,4), %ecx
movl %ecx, -0x6a(%rsp,%rax)
addq $0x4, %rax
cmpq $0x9a, %rax
jne 0x4bf7
xorl %eax, %eax
movl %ebp, %r14d
subl $0x1, %r14d
cmovbl %eax, %r14d
movl 0x20(%rsp,%r14,4), %esi
testq %rsi, %rsi
je 0x4c2c
movq %rbx, %rdi
callq 0xb22a
jmp 0x4c31
movl $0x3, %eax
cmpq $0x2, %r14
ja 0x4c44
testb %bpl, %bpl
jne 0x4c44
incq %r14
cmpl $0x1, %eax
ja 0x4c18
movl $0x1, %ebp
cmpl $0x4, %eax
je 0x4bd2
jmp 0x4d45
leaq 0x60(%rbx), %rdi
movq %rdi, 0x18(%rsp)
callq 0xaa23
movl $0x3, %ecx
testl %eax, %eax
je 0x4d43
movl 0xb0(%rbx), %eax
movl %eax, 0xc(%rsp)
testl %eax, %eax
je 0x4d43
movq 0xa8(%rbx), %rax
movq %rax, 0x10(%rsp)
xorl %r13d, %r13d
leaq 0x87fa(%rip), %r15      # 0xd490
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 0x6114
testl %eax, %eax
jne 0x4bc6
movl %r13d, %eax
andl $0x180, %eax            # imm = 0x180
addq 0x18(%rsp), %rax
andl $0x180, %r12d           # imm = 0x180
xorl %ecx, %ecx
movb (%rax,%rcx), %dl
movb (%rcx,%r15), %sil
cmpl $0xf, %ecx
je 0x4ced
incq %rcx
cmpb %sil, %dl
je 0x4cd9
cmpb %sil, %dl
jne 0x4d28
movq 0x80(%rbx,%r12), %rsi
movq %rbx, %rdi
callq 0xb22a
testl %ebp, %ebp
jne 0x4d0b
cmpl $0x2, %eax
jb 0x4d41
testb %bpl, %bpl
setne %cl
movl 0x8(%rsp), %edx
incl %edx
movl %edx, 0x8(%rsp)
cmpl %ebp, %edx
sete %dl
testb %dl, %cl
jne 0x4c44
incl %r14d
subl $-0x80, %r13d
cmpl 0xc(%rsp), %r14d
jne 0x4ca1
movl $0x3, %ecx
jmp 0x4d43
movl %eax, %ecx
movl %ecx, %eax
movl $0xd, %ebp
cmpl $0x1, %eax
ja 0x4bd2
movq 0x58(%rbx), %r14
jne 0x4e90
movl $0x6b, %eax
cmpb $0x0, (%rbx,%rax)
jne 0x4bd2
incq %rax
cmpq $0xa0, %rax
jne 0x4d62
cmpw $0x100, 0xc8(%rbx)      # imm = 0x100
jne 0x4bd2
cmpb $0x9, 0xcc(%rbx)
jne 0x4bd2
leaq 0xa8(%rbx), %rdi
callq 0xaab2
movl 0xb4(%rbx), %ecx
movl %ecx, 0x2c(%rbx)
movb 0xce(%rbx), %cl
movb %cl, 0x2(%rbx)
cmpb $0x1, %cl
jne 0x4bd2
movzbl 0xcd(%rbx), %ecx
movl $0x1, %edx
shll %cl, %edx
movw %dx, 0xa(%rbx)
cmpl $0xf, %ecx
ja 0x4bd2
movl 0xbc(%rbx), %edx
cmpl $0x7ffffffd, %edx       # imm = 0x7FFFFFFD
ja 0x4bd2
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)
shll %cl, %edx
addq %r14, %rsi
movq %rsi, 0x38(%rbx)
addq %rdi, %rdx
cmpq %rdx, %rax
jb 0x4bd2
movl 0xc0(%rbx), %eax
movq %rax, 0x40(%rbx)
xorl %r14d, %r14d
xorl %r15d, %r15d
testl %r15d, %r15d
jne 0x4e75
movzwl 0xa(%rbx), %eax
cmpl %eax, %r14d
jae 0x4bd2
movl 0x28(%rbx), %edx
movl 0x40(%rbx), %ecx
addl $-0x2, %ecx
addl $-0x2, %edx
cmpl %edx, %ecx
jae 0x4e5a
movl %ecx, %ecx
imulq %rax, %rcx
addq 0x48(%rbx), %rcx
jmp 0x4e5c
xorl %ecx, %ecx
movl %r14d, %esi
addq %rcx, %rsi
movq %rbx, %rdi
callq 0x6114
testl %eax, %eax
jne 0x4bc6
incl %r14d
movl %r15d, %eax
cmpb $-0x7f, 0x60(%rbx,%rax)
je 0x5037
addl $0x20, %r15d
andl $0x1ff, %r15d           # imm = 0x1FF
jmp 0x4e2c
cmpw $0x200, 0x6b(%rbx)      # imm = 0x200
jne 0x4bd2
movzwl 0x76(%rbx), %esi
testl %esi, %esi
jne 0x4eaa
movl 0x84(%rbx), %esi
movl %esi, 0x2c(%rbx)
movzbl 0x70(%rbx), %edi
movb %dil, 0x2(%rbx)
leal -0x1(%rdi), %eax
cmpb $0x1, %al
ja 0x4bd2
movzbl 0x6d(%rbx), %eax
movw %ax, 0xa(%rbx)
leal -0x1(%rax), %ecx
movl %eax, %edx
xorb %cl, %dl
cmpb %cl, %dl
jbe 0x4bd2
movzbl 0x72(%rbx), %r8d
shll $0x8, %r8d
movzbl 0x71(%rbx), %ecx
orl %ecx, %r8d
movw %r8w, 0x8(%rbx)
testb $0xf, %cl
jne 0x4bd2
movzwl 0x73(%rbx), %ecx
testl %ecx, %ecx
jne 0x4f03
movl 0x80(%rbx), %ecx
movzwl 0x6e(%rbx), %r9d
testl %r9d, %r9d
je 0x4bd2
imull %esi, %edi
movl %r8d, %r10d
shrl $0x4, %r10d
addl %edi, %r10d
addl %r9d, %r10d
subl %r10d, %ecx
jb 0x4bd2
movzwl %ax, %r11d
movl %ecx, %eax
xorl %edx, %edx
divl %r11d
cmpl %r11d, %ecx
jb 0x4bd2
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 0x4bd2
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 0x509c
movzwl 0x8a(%rbx), %eax
orw %r8w, %ax
jne 0x4bd2
movl 0x8c(%rbx), %eax
movq %rax, 0x40(%rbx)
leal 0x1ff(,%rcx,4), %eax
shrl $0x9, %eax
cmpl %eax, %esi
jb 0x4bd2
movq $-0x1, 0x20(%rbx)
movb $-0x80, 0x4(%rbx)
movb $0x3, %r15b
cmpw $0x1, 0x90(%rbx)
jne 0x50f7
incq %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6114
testl %eax, %eax
jne 0x50f7
movb $0x0, 0x4(%rbx)
cmpw $0xaa55, 0x25e(%rbx)    # imm = 0xAA55
jne 0x50f7
cmpl $0x41615252, 0x60(%rbx) # imm = 0x41615252
jne 0x50f7
cmpl $0x61417272, 0x244(%rbx) # imm = 0x61417272
jne 0x50f7
movl 0x24c(%rbx), %eax
movl %eax, 0x20(%rbx)
jmp 0x50f7
movl 0x74(%rbx,%rax), %r14d
cmpl $0x2, %r14d
jb 0x4bd2
cmpl 0x28(%rbx), %r14d
jae 0x4bd2
movzwl 0xa(%rbx), %eax
leal -0x2(%r14), %ecx
imull %eax, %ecx
addq 0x48(%rbx), %rcx
movq %rcx, 0x50(%rbx)
movl %r14d, %esi
shrl $0x7, %esi
addq 0x38(%rbx), %rsi
movq %rbx, %rdi
callq 0x6114
testl %eax, %eax
jne 0x4bc6
movl %r14d, %eax
andl $0x7f, %eax
movl 0x60(%rbx,%rax,4), %eax
cmpl $-0x1, %eax
je 0x50ec
incl %r14d
cmpl %r14d, %eax
movl %eax, %r14d
je 0x5063
jmp 0x4bd2
testw %r8w, %r8w
je 0x4bd2
movl %edi, %edi
addq %rdi, %rdx
movq %rdx, 0x40(%rbx)
leal -0xff6(%rax), %edx
cmpl $0xefff, %edx           # imm = 0xEFFF
ja 0x50c1
addl %ecx, %ecx
jmp 0x50cd
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 0x4bd2
movq $-0x1, 0x20(%rbx)
movb $-0x80, 0x4(%rbx)
jmp 0x50f7
movq $-0x1, 0x20(%rbx)
movb $0x4, %r15b
movb %r15b, (%rbx)
movzwl 0xc3c7(%rip), %eax      # 0x114c8
incl %eax
movw %ax, 0xc3be(%rip)       # 0x114c8
movw %ax, 0x6(%rbx)
xorl %ebp, %ebp
jmp 0x4bd2