// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/ufat_ent.c
// Function: ufat_lfn_parse
void ufat_lfn_parse(struct ufat_lfn_parser *s, const uint8_t *data,
		    ufat_block_t blk, unsigned int pos)
{
	const int fr_seq = data[0];
	uint16_t frag_data[13];
	int fr_pos;
	int fr_len;
	int i;

	fr_pos = ((fr_seq & 0x3f) - 1) * 13;
	fr_len = 13;
	if (fr_pos + fr_len > UFAT_LFN_MAX_CHARS)
		fr_len = UFAT_LFN_MAX_CHARS - fr_pos;

	/* Check against expected sequence number and checksum */
	if (fr_seq & 0x40) {
		s->start_block = blk;
		s->start_pos = pos;
		s->seq = fr_seq & 0x3f;
		s->len = fr_pos + fr_len;
		s->short_checksum = data[0x0d];
	} else if (fr_seq != s->seq ||
		   s->short_checksum != data[0x0d]) {
		ufat_lfn_reset(s);
		return;
	}
	s->seq--;

	/* Unpack and copy fragment */
	for (i = 0; i < 5; i++)
		frag_data[i] = r16(data + 0x01 + i * 2);
	for (i = 0; i < 6; i++)
		frag_data[i + 5] = r16(data + 0x0e + i * 2);
	frag_data[11] = r16(data + 0x1c);
	frag_data[12] = r16(data + 0x1e);

	for (i = 0; i < fr_len; i++)
		s->buf[fr_pos + i] = frag_data[i];
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movq %rsi, 0x48(%rsp)
movq %rdx, 0x40(%rsp)
movl %ecx, 0x3c(%rsp)
movq 0x48(%rsp), %rax
movzbl (%rax), %eax
movl %eax, 0x38(%rsp)
movl 0x38(%rsp), %eax
andl $0x3f, %eax
subl $0x1, %eax
imull $0xd, %eax, %eax
movl %eax, 0xc(%rsp)
movl $0xd, 0x8(%rsp)
movl 0xc(%rsp), %eax
addl 0x8(%rsp), %eax
cmpl $0xff, %eax
jle 0x71a8
movl $0xff, %eax
subl 0xc(%rsp), %eax
movl %eax, 0x8(%rsp)
movl 0x38(%rsp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x71fe
movq 0x40(%rsp), %rcx
movq 0x50(%rsp), %rax
movq %rcx, (%rax)
movl 0x3c(%rsp), %ecx
movq 0x50(%rsp), %rax
movl %ecx, 0x8(%rax)
movl 0x38(%rsp), %ecx
andl $0x3f, %ecx
movq 0x50(%rsp), %rax
movl %ecx, 0x14(%rax)
movl 0xc(%rsp), %ecx
addl 0x8(%rsp), %ecx
movq 0x50(%rsp), %rax
movl %ecx, 0x10(%rax)
movq 0x48(%rsp), %rax
movb 0xd(%rax), %cl
movq 0x50(%rsp), %rax
movb %cl, 0xc(%rax)
jmp 0x7233
movl 0x38(%rsp), %eax
movq 0x50(%rsp), %rcx
cmpl 0x14(%rcx), %eax
jne 0x7222
movq 0x50(%rsp), %rax
movzbl 0xc(%rax), %eax
movq 0x48(%rsp), %rcx
movzbl 0xd(%rcx), %ecx
cmpl %ecx, %eax
je 0x7231
movq 0x50(%rsp), %rdi
callq 0x7340
jmp 0x732d
jmp 0x7233
movq 0x50(%rsp), %rax
movl 0x14(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x14(%rax)
movl $0x0, 0x4(%rsp)
cmpl $0x5, 0x4(%rsp)
jge 0x7283
movq 0x48(%rsp), %rdi
addq $0x1, %rdi
movl 0x4(%rsp), %eax
shll %eax
cltq
addq %rax, %rdi
callq 0x6830
movw %ax, %cx
movslq 0x4(%rsp), %rax
movw %cx, 0x10(%rsp,%rax,2)
movl 0x4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4(%rsp)
jmp 0x7249
movl $0x0, 0x4(%rsp)
cmpl $0x6, 0x4(%rsp)
jge 0x72c9
movq 0x48(%rsp), %rdi
addq $0xe, %rdi
movl 0x4(%rsp), %eax
shll %eax
cltq
addq %rax, %rdi
callq 0x6830
movw %ax, %cx
movl 0x4(%rsp), %eax
addl $0x5, %eax
cltq
movw %cx, 0x10(%rsp,%rax,2)
movl 0x4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4(%rsp)
jmp 0x728b
movq 0x48(%rsp), %rdi
addq $0x1c, %rdi
callq 0x6830
movw %ax, 0x26(%rsp)
movq 0x48(%rsp), %rdi
addq $0x1e, %rdi
callq 0x6830
movw %ax, 0x28(%rsp)
movl $0x0, 0x4(%rsp)
movl 0x4(%rsp), %eax
cmpl 0x8(%rsp), %eax
jge 0x732d
movslq 0x4(%rsp), %rax
movw 0x10(%rsp,%rax,2), %dx
movq 0x50(%rsp), %rax
movl 0xc(%rsp), %ecx
addl 0x4(%rsp), %ecx
movslq %ecx, %rcx
movw %dx, 0x18(%rax,%rcx,2)
movl 0x4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4(%rsp)
jmp 0x72f7
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)