// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/ufat_ent.c
// Function: ufat_short_first
void ufat_short_first(const char *long_name,
		      char *short_name, char *ext_text)
{
	int len = strlen(long_name);
	int ext = len;
	int i, j;

	while (ext >= 0 && long_name[ext] != '.')
		ext--;

	if (ext > 0)
		ext++;
	else
		ext = len;

	j = 0;
	for (i = ext; j < 3 && long_name[i]; i++) {
		char c = long_name[i];

		if (is_legal_dos_char(c))
			ext_text[j++] = toupper(c);
	}
	ext_text[j] = 0;

	j = 0;
	for (i = 0; j < 8 && i < ext; i++) {
		char c = long_name[i];

		if (is_legal_dos_char(c))
			short_name[j++] = toupper(c);
	}
	short_name[j] = 0;

	if (!j) {
		for (i = 0; i < 8; i++)
			short_name[i] = '~';
		short_name[8] = 0;
	}
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdx, 0x20(%rsp)
movq 0x30(%rsp), %rdi
callq 0x20c0
movl %eax, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
movl %eax, 0x18(%rsp)
xorl %eax, %eax
cmpl $0x0, 0x18(%rsp)
movb %al, 0xd(%rsp)
jl 0x6bbe
movq 0x30(%rsp), %rax
movslq 0x18(%rsp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x2e, %eax
setne %al
movb %al, 0xd(%rsp)
movb 0xd(%rsp), %al
testb $0x1, %al
jne 0x6bc8
jmp 0x6bd5
movl 0x18(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x18(%rsp)
jmp 0x6b99
cmpl $0x0, 0x18(%rsp)
jle 0x6be9
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
jmp 0x6bf1
movl 0x1c(%rsp), %eax
movl %eax, 0x18(%rsp)
movl $0x0, 0x10(%rsp)
movl 0x18(%rsp), %eax
movl %eax, 0x14(%rsp)
xorl %eax, %eax
cmpl $0x3, 0x10(%rsp)
movb %al, 0xc(%rsp)
jge 0x6c26
movq 0x30(%rsp), %rax
movslq 0x14(%rsp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
setne %al
movb %al, 0xc(%rsp)
movb 0xc(%rsp), %al
testb $0x1, %al
jne 0x6c30
jmp 0x6c86
movq 0x30(%rsp), %rax
movslq 0x14(%rsp), %rcx
movb (%rax,%rcx), %al
movb %al, 0xf(%rsp)
movsbl 0xf(%rsp), %edi
callq 0x6d70
cmpl $0x0, %eax
je 0x6c74
movsbl 0xf(%rsp), %edi
callq 0x2080
movb %al, %dl
movq 0x20(%rsp), %rax
movl 0x10(%rsp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, 0x10(%rsp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
jmp 0x6c76
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x6c01
movq 0x20(%rsp), %rax
movslq 0x10(%rsp), %rcx
movb $0x0, (%rax,%rcx)
movl $0x0, 0x10(%rsp)
movl $0x0, 0x14(%rsp)
xorl %eax, %eax
cmpl $0x8, 0x10(%rsp)
movb %al, 0xb(%rsp)
jge 0x6cc0
movl 0x14(%rsp), %eax
cmpl 0x18(%rsp), %eax
setl %al
movb %al, 0xb(%rsp)
movb 0xb(%rsp), %al
testb $0x1, %al
jne 0x6cca
jmp 0x6d1d
movq 0x30(%rsp), %rax
movslq 0x14(%rsp), %rcx
movb (%rax,%rcx), %al
movb %al, 0xe(%rsp)
movsbl 0xe(%rsp), %edi
callq 0x6d70
cmpl $0x0, %eax
je 0x6d0e
movsbl 0xe(%rsp), %edi
callq 0x2080
movb %al, %dl
movq 0x28(%rsp), %rax
movl 0x10(%rsp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, 0x10(%rsp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
jmp 0x6d10
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x6ca4
movq 0x28(%rsp), %rax
movslq 0x10(%rsp), %rcx
movb $0x0, (%rax,%rcx)
cmpl $0x0, 0x10(%rsp)
jne 0x6d65
movl $0x0, 0x14(%rsp)
cmpl $0x8, 0x14(%rsp)
jge 0x6d5c
movq 0x28(%rsp), %rax
movslq 0x14(%rsp), %rcx
movb $0x7e, (%rax,%rcx)
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x6d3a
movq 0x28(%rsp), %rax
movb $0x0, 0x8(%rax)
addq $0x38, %rsp
retq
nopw (%rax,%rax)