// File: /workspace/github_c_makefile_star2_O2/cglindkamp[P]dfm/src/filedata.c
// Function: filedata_format_list_line
size_t filedata_format_list_line(struct filedata *filedata, wchar_t *buffer, size_t len, size_t width)
{
	wchar_t info[INFO_SEPARATOR_LENGTH + INFO_LINK_LENGTH + INFO_SIZE_DIR_LENGTH + 1];
	size_t info_size;
	size_t char_count = 0;
	size_t display_count = 0;

	info_size = render_info(info, filedata);

	if(width > info_size) {
		char_count = render_filename(buffer, len - info_size, width - info_size, filedata->filename);
		if(char_count + info_size > len)
			return char_count + info_size;

		display_count = wcswidth(buffer, len);
	} else
		info_size = width;


	if(display_count + info_size < width) {
		size_t padlength = width - display_count - info_size;

		if(char_count + padlength + info_size <= len)
			wmemset(&buffer[char_count], L' ', padlength);

		char_count += padlength;
	}
	buffer[char_count] = L'\0';

	if(char_count + info_size <= len)
		wcsncat(buffer, info + wcslen(info) - info_size, info_size);

	return char_count + info_size;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rcx, %r15
movq %rdx, %r13
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x223a(%rip), %rsi      # 0x9358
leaq 0x50(%rsp), %rdi
callq 0x33e0
cmpb $0x1, 0x8(%rbx)
jne 0x7152
leaq 0x220b(%rip), %rax      # 0x9340
leaq 0x2214(%rip), %rsi      # 0x9350
cmpb $0x0, 0x9(%rbx)
cmovneq %rax, %rsi
leaq 0x50(%rsp), %rdi
callq 0x3050
pushq $0x9
jmp 0x7154
pushq $0x6
popq %r14
movl $0xf000, %eax           # imm = 0xF000
andl 0x28(%rbx), %eax
cmpl $0x4000, %eax           # imm = 0x4000
jne 0x7178
leaq 0x21f4(%rip), %rsi      # 0x9360
leaq 0x50(%rsp), %rdi
callq 0x3050
jmp 0x71c4
andq $0x0, 0x10(%rsp)
movaps 0x213b(%rip), %xmm0     # 0x92c0
movaps %xmm0, (%rsp)
cmpb $0x1, 0xa9(%rbx)
jne 0x719e
movq 0x40(%rbx), %rsi
movq %rsp, %rdi
callq 0x705e
leaq 0x50(%rsp), %rdi
callq 0x3280
leaq (%rsp,%rax,4), %rdi
addq $0x50, %rdi
leaq 0x21c1(%rip), %rdx      # 0x9378
pushq $0x6
popq %rsi
movq %rsp, %rcx
xorl %eax, %eax
callq 0x3410
movq %r15, %rax
subq %r14, %rax
movq %rax, 0x48(%rsp)
jbe 0x726b
movq %r15, 0x20(%rsp)
movq %r13, 0x38(%rsp)
movq %r14, 0x30(%rsp)
subq %r14, %r13
movq %r13, 0x40(%rsp)
movq (%rbx), %r13
movq %r13, %rdi
callq 0x3230
movq %rax, %rbp
xorl %r14d, %r14d
xorl %r15d, %r15d
movq %r12, 0x28(%rsp)
movq %r12, %rbx
testq %rbp, %rbp
je 0x7275
movq %rsp, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x3440
testl %eax, %eax
js 0x7227
movl (%rsp), %edi
movl %eax, %r12d
jmp 0x7237
movl $0xfffd, (%rsp)         # imm = 0xFFFD
movl $0xfffd, %edi           # imm = 0xFFFD
pushq $0x1
popq %r12
callq 0x3480
cmpl $-0x1, %eax
je 0x7263
cltq
addq %r15, %rax
cmpq 0x48(%rsp), %rax
ja 0x7275
cmpq 0x40(%rsp), %r14
jae 0x7260
movl (%rsp), %ecx
movl %ecx, (%rbx)
addq $0x4, %rbx
movq %rax, %r15
incq %r14
subq %r12, %rbp
addq %r12, %r13
jmp 0x7208
xorl %r14d, %r14d
movq %r15, %rbp
xorl %eax, %eax
jmp 0x72a2
andl $0x0, (%rbx)
movq 0x30(%rsp), %rbp
leaq (%r14,%rbp), %rbx
movq 0x38(%rsp), %r13
cmpq %r13, %rbx
ja 0x7300
movq 0x28(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x3180
cltq
movq 0x20(%rsp), %r15
addq %rbp, %rax
subq %rax, %r15
jbe 0x72ca
movq %r15, %rdx
addq %r14, %r15
leaq (%r15,%rbp), %rbx
cmpq %r13, %rbx
ja 0x72c5
leaq (%r12,%r14,4), %rdi
pushq $0x20
popq %rsi
callq 0x3330
movq %r15, %r14
jmp 0x72ce
leaq (%r14,%rbp), %rbx
andl $0x0, (%r12,%r14,4)
cmpq %r13, %rbx
ja 0x7300
leaq 0x50(%rsp), %rdi
callq 0x3280
leaq (%rsp,%rax,4), %rsi
addq $0x50, %rsi
leaq (,%rbp,4), %rax
subq %rax, %rsi
movq %r12, %rdi
movq %rbp, %rdx
callq 0x31b0
movq %rbx, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq