// File: /workspace/github_c_makefile_star2_O0/lb3361[P]dosfs/ff.c
// Function: get_fileinfo
static void get_fileinfo (
	DIR* dp,			/* Pointer to the directory object */
	FILINFO* fno		/* Pointer to the file information to be filled */
)
{
	UINT si, di;
#if FF_USE_LFN
	BYTE lcf;
	WCHAR wc, hs;
	FATFS *fs = dp->obj.fs;
#else
	TCHAR c;
#endif


	fno->fname[0] = 0;			/* Invaidate file info */
	if (dp->sect == 0) return;	/* Exit if read pointer has reached end of directory */

#if FF_USE_LFN		/* LFN configuration */
#if FF_FS_EXFAT
	if (fs->fs_type == FS_EXFAT) {	/* On the exFAT volume */
		get_xfileinfo(fs->dirbuf, fno);
		return;
	} else
#endif
	{	/* On the FAT/FAT32 volume */
		if (dp->blk_ofs != 0xFFFFFFFF) {	/* Get LFN if available */
			si = di = hs = 0;
			while (fs->lfnbuf[si] != 0) {
				wc = fs->lfnbuf[si++];		/* Get an LFN character (UTF-16) */
				if (hs == 0 && IsSurrogate(wc)) {	/* Is it a surrogate? */
					hs = wc; continue;		/* Get low surrogate */
				}
				wc = put_utf((DWORD)hs << 16 | wc, &fno->fname[di], FF_LFN_BUF - di);	/* Store it in UTF-16 or UTF-8 encoding */
				if (wc == 0) { di = 0; break; }	/* Invalid char or buffer overflow? */
				di += wc;
				hs = 0;
			}
			if (hs != 0) di = 0;	/* Broken surrogate pair? */
			fno->fname[di] = 0;		/* Terminate the LFN (null string means LFN is invalid) */
		}
	}

	si = di = 0;
	while (si < 11) {		/* Get SFN from SFN entry */
		wc = dp->dir[si++];			/* Get a char */
		if (wc == ' ') continue;	/* Skip padding spaces */
		if (wc == RDDEM) wc = DDEM;	/* Restore replaced DDEM character */
		if (si == 9 && di < FF_SFN_BUF) fno->altname[di++] = '.';	/* Insert a . if extension is exist */
#if FF_LFN_UNICODE >= 1	/* Unicode output */
		if (dbc_1st((BYTE)wc) && si != 8 && si != 11 && dbc_2nd(dp->dir[si])) {	/* Make a DBC if needed */
			wc = wc << 8 | dp->dir[si++];
		}
		wc = ff_oem2uni(wc, CODEPAGE);		/* ANSI/OEM -> Unicode */
		if (wc == 0) { di = 0; break; }		/* Wrong char in the current code page? */
		wc = put_utf(wc, &fno->altname[di], FF_SFN_BUF - di);	/* Store it in Unicode */
		if (wc == 0) { di = 0; break; }		/* Buffer overflow? */
		di += wc;
#else					/* ANSI/OEM output */
		fno->altname[di++] = (TCHAR)wc;	/* Store it without any conversion */
#endif
	}
	fno->altname[di] = 0;	/* Terminate the SFN  (null string means SFN is invalid) */

	if (fno->fname[0] == 0) {	/* If LFN is invalid, altname[] needs to be copied to fname[] */
		if (di == 0) {	/* If LFN and SFN both are invalid, this object is inaccesible */
			fno->fname[di++] = '?';
		} else {
			for (si = di = 0, lcf = NS_BODY; fno->altname[si]; si++, di++) {	/* Copy altname[] to fname[] with case information */
				wc = (WCHAR)fno->altname[si];
				if (wc == '.') lcf = NS_EXT;
				if (IsUpper(wc) && (dp->dir[DIR_NTres] & lcf)) wc += 0x20;
				fno->fname[di] = (TCHAR)wc;
			}
		}
		fno->fname[di] = 0;	/* Terminate the LFN */
		if (!dp->dir[DIR_NTres]) fno->altname[0] = 0;	/* Altname is not needed if neither LFN nor case info is exist. */
	}

#else	/* Non-LFN configuration */
	si = di = 0;
	while (si < 11) {		/* Copy name body and extension */
		c = (TCHAR)dp->dir[si++];
		if (c == ' ') continue;		/* Skip padding spaces */
		if (c == RDDEM) c = DDEM;	/* Restore replaced DDEM character */
		if (si == 9) fno->fname[di++] = '.';/* Insert a . if extension is exist */
		fno->fname[di++] = c;
	}
	fno->fname[di] = 0;
#endif

	fno->fattrib = dp->dir[DIR_Attr];					/* Attribute */
	fno->fsize = ld_dword(dp->dir + DIR_FileSize);		/* Size */
	fno->ftime = ld_word(dp->dir + DIR_ModTime + 0);	/* Time */
	fno->fdate = ld_word(dp->dir + DIR_ModTime + 2);	/* Date */
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movb $0x0, 0x1a(%rax)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x38(%rax)
jne 0x87d3
jmp 0x8b88
movq -0x28(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x4, %eax
jne 0x87f5
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0xfaf0
jmp 0x8b88
movq -0x8(%rbp), %rax
cmpl $-0x1, 0x54(%rax)
je 0x88e7
movw $0x0, -0x1e(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x14(%rbp), %ecx
movzwl (%rax,%rcx,2), %eax
cmpl $0x0, %eax
je 0x88cb
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x14(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x14(%rbp)
movl %ecx, %ecx
movw (%rax,%rcx,2), %ax
movw %ax, -0x1c(%rbp)
movzwl -0x1e(%rbp), %eax
cmpl $0x0, %eax
jne 0x8875
movzwl -0x1c(%rbp), %eax
cmpl $0xd800, %eax           # imm = 0xD800
jl 0x8875
movzwl -0x1c(%rbp), %eax
cmpl $0xdfff, %eax           # imm = 0xDFFF
jg 0x8875
movw -0x1c(%rbp), %ax
movw %ax, -0x1e(%rbp)
jmp 0x8817
movzwl -0x1e(%rbp), %edi
shll $0x10, %edi
movzwl -0x1c(%rbp), %eax
orl %eax, %edi
movq -0x10(%rbp), %rsi
addq $0x1a, %rsi
movl -0x18(%rbp), %eax
addq %rax, %rsi
movl $0xff, %edx
subl -0x18(%rbp), %edx
callq 0xa730
movzbl %al, %eax
movw %ax, -0x1c(%rbp)
movzwl -0x1c(%rbp), %eax
cmpl $0x0, %eax
jne 0x88b6
movl $0x0, -0x18(%rbp)
jmp 0x88cb
movzwl -0x1c(%rbp), %eax
addl -0x18(%rbp), %eax
movl %eax, -0x18(%rbp)
movw $0x0, -0x1e(%rbp)
jmp 0x8817
movzwl -0x1e(%rbp), %eax
cmpl $0x0, %eax
je 0x88db
movl $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
movb $0x0, 0x1a(%rax,%rcx)
jmp 0x88e9
movl $0x0, -0x18(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0xb, -0x14(%rbp)
jae 0x8a21
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x14(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x14(%rbp)
movl %ecx, %ecx
movzbl (%rax,%rcx), %eax
movw %ax, -0x1c(%rbp)
movzwl -0x1c(%rbp), %eax
cmpl $0x20, %eax
jne 0x8929
jmp 0x88f7
movzwl -0x1c(%rbp), %eax
cmpl $0x5, %eax
jne 0x8938
movw $0xe5, -0x1c(%rbp)
cmpl $0x9, -0x14(%rbp)
jne 0x895a
cmpl $0xc, -0x18(%rbp)
jae 0x895a
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x18(%rbp)
movl %ecx, %ecx
movb $0x2e, 0xd(%rax,%rcx)
movw -0x1c(%rbp), %ax
movzbl %al, %edi
callq 0xa950
cmpl $0x0, %eax
je 0x89b6
cmpl $0x8, -0x14(%rbp)
je 0x89b6
cmpl $0xb, -0x14(%rbp)
je 0x89b6
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x14(%rbp), %ecx
movzbl (%rax,%rcx), %edi
callq 0xfcc0
cmpl $0x0, %eax
je 0x89b6
movzwl -0x1c(%rbp), %eax
shll $0x8, %eax
movq -0x8(%rbp), %rcx
movq 0x40(%rcx), %rcx
movl -0x14(%rbp), %edx
movl %edx, %esi
addl $0x1, %esi
movl %esi, -0x14(%rbp)
movl %edx, %edx
movzbl (%rcx,%rdx), %ecx
orl %ecx, %eax
movw %ax, -0x1c(%rbp)
movl $0x1b5, %esi            # imm = 0x1B5
movzwl -0x1c(%rbp), %edi
callq 0xfee0
movw %ax, -0x1c(%rbp)
movzwl -0x1c(%rbp), %eax
cmpl $0x0, %eax
jne 0x89da
movl $0x0, -0x18(%rbp)
jmp 0x8a21
movzwl -0x1c(%rbp), %edi
movq -0x10(%rbp), %rsi
addq $0xd, %rsi
movl -0x18(%rbp), %eax
addq %rax, %rsi
movl $0xc, %edx
subl -0x18(%rbp), %edx
callq 0xa730
movzbl %al, %eax
movw %ax, -0x1c(%rbp)
movzwl -0x1c(%rbp), %eax
cmpl $0x0, %eax
jne 0x8a12
movl $0x0, -0x18(%rbp)
jmp 0x8a21
movzwl -0x1c(%rbp), %eax
addl -0x18(%rbp), %eax
movl %eax, -0x18(%rbp)
jmp 0x88f7
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
movb $0x0, 0xd(%rax,%rcx)
movq -0x10(%rbp), %rax
movsbl 0x1a(%rax), %eax
cmpl $0x0, %eax
jne 0x8b1e
cmpl $0x0, -0x18(%rbp)
jne 0x8a5f
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x18(%rbp)
movl %ecx, %ecx
movb $0x3f, 0x1a(%rax,%rcx)
jmp 0x8afa
movl $0x0, -0x18(%rbp)
movl $0x0, -0x14(%rbp)
movb $0x8, -0x19(%rbp)
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
cmpb $0x0, 0xd(%rax,%rcx)
je 0x8af8
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
movsbl 0xd(%rax,%rcx), %eax
movw %ax, -0x1c(%rbp)
movzwl -0x1c(%rbp), %eax
cmpl $0x2e, %eax
jne 0x8a9c
movb $0x10, -0x19(%rbp)
movzwl -0x1c(%rbp), %eax
cmpl $0x41, %eax
jl 0x8ad0
movzwl -0x1c(%rbp), %eax
cmpl $0x5a, %eax
jg 0x8ad0
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movzbl 0xc(%rax), %eax
movzbl -0x19(%rbp), %ecx
andl %ecx, %eax
cmpl $0x0, %eax
je 0x8ad0
movzwl -0x1c(%rbp), %eax
addl $0x20, %eax
movw %ax, -0x1c(%rbp)
movw -0x1c(%rbp), %ax
movb %al, %dl
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
movb %dl, 0x1a(%rax,%rcx)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x8a71
jmp 0x8afa
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
movb $0x0, 0x1a(%rax,%rcx)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
cmpb $0x0, 0xc(%rax)
jne 0x8b1c
movq -0x10(%rbp), %rax
movb $0x0, 0xd(%rax)
jmp 0x8b1e
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movb 0xb(%rax), %cl
movq -0x10(%rbp), %rax
movb %cl, 0xc(%rax)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rdi
addq $0x1c, %rdi
callq 0x6510
movl %eax, %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rdi
addq $0x16, %rdi
callq 0x9390
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0xa(%rax)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rdi
addq $0x16, %rdi
addq $0x2, %rdi
callq 0x9390
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x8(%rax)
addq $0x30, %rsp
popq %rbp
retq
nop