// File: /workspace/github_c_makefile_star2_O0/lb3361[P]dosfs/ff.c
// Function: get_xfileinfo
static void get_xfileinfo (
	BYTE* dirb,			/* Pointer to the direcotry entry block 85+C0+C1s */
	FILINFO* fno		/* Buffer to store the extracted file information */
)
{
	WCHAR wc, hs;
	UINT di, si, nc;

	/* Get file name from the entry block */
	si = SZDIRE * 2;	/* 1st C1 entry */
	nc = 0; hs = 0; di = 0;
	while (nc < dirb[XDIR_NumName]) {
		if (si >= MAXDIRB(FF_MAX_LFN)) { di = 0; break; }	/* Truncated directory block? */
		if ((si % SZDIRE) == 0) si += 2;		/* Skip entry type field */
		wc = ld_word(dirb + si); si += 2; nc++;	/* Get a character */
		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 API encoding */
		if (wc == 0) { di = 0; break; }	/* Buffer overflow or wrong encoding? */
		di += wc;
		hs = 0;
	}
	if (hs != 0) di = 0;					/* Broken surrogate pair? */
	if (di == 0) fno->fname[di++] = '?';	/* Inaccessible object name? */
	fno->fname[di] = 0;						/* Terminate the name */
	fno->altname[0] = 0;					/* exFAT does not support SFN */

	fno->fattrib = dirb[XDIR_Attr];			/* Attribute */
	fno->fsize = (fno->fattrib & AM_DIR) ? 0 : ld_qword(dirb + XDIR_FileSize);	/* Size */
	fno->ftime = ld_word(dirb + XDIR_ModTime + 0);	/* Time */
	fno->fdate = ld_word(dirb + XDIR_ModTime + 2);	/* Date */
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x40, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movw $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x20(%rbp), %eax
movq -0x8(%rbp), %rcx
movzbl 0x23(%rcx), %ecx
cmpl %ecx, %eax
jae 0xfbfe
cmpl $0x260, -0x1c(%rbp)     # imm = 0x260
jb 0xfb43
movl $0x0, -0x18(%rbp)
jmp 0xfbfe
movl -0x1c(%rbp), %eax
andl $0x1f, %eax
cmpl $0x0, %eax
jne 0xfb57
movl -0x1c(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %eax
addq %rax, %rdi
callq 0x9390
movw %ax, -0x12(%rbp)
movl -0x1c(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x1c(%rbp)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movzwl -0x14(%rbp), %eax
cmpl $0x0, %eax
jne 0xfba8
movzwl -0x12(%rbp), %eax
cmpl $0xd800, %eax           # imm = 0xD800
jl 0xfba8
movzwl -0x12(%rbp), %eax
cmpl $0xdfff, %eax           # imm = 0xDFFF
jg 0xfba8
movw -0x12(%rbp), %ax
movw %ax, -0x14(%rbp)
jmp 0xfb1b
movzwl -0x14(%rbp), %edi
shll $0x10, %edi
movzwl -0x12(%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, -0x12(%rbp)
movzwl -0x12(%rbp), %eax
cmpl $0x0, %eax
jne 0xfbe9
movl $0x0, -0x18(%rbp)
jmp 0xfbfe
movzwl -0x12(%rbp), %eax
addl -0x18(%rbp), %eax
movl %eax, -0x18(%rbp)
movw $0x0, -0x14(%rbp)
jmp 0xfb1b
movzwl -0x14(%rbp), %eax
cmpl $0x0, %eax
je 0xfc0e
movl $0x0, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jne 0xfc2a
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)
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
movb $0x0, 0x1a(%rax,%rcx)
movq -0x10(%rbp), %rax
movb $0x0, 0xd(%rax)
movq -0x8(%rbp), %rax
movb 0x4(%rax), %cl
movq -0x10(%rbp), %rax
movb %cl, 0xc(%rax)
movq -0x10(%rbp), %rax
movzbl 0xc(%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0xfc64
xorl %eax, %eax
movq %rax, -0x28(%rbp)
jmp 0xfc75
movq -0x8(%rbp), %rdi
addq $0x38, %rdi
callq 0xd380
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rdi
addq $0xc, %rdi
callq 0x9390
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0xa(%rax)
movq -0x8(%rbp), %rdi
addq $0xc, %rdi
addq $0x2, %rdi
callq 0x9390
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x8(%rax)
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)