// File: /workspace/github_c_makefile_star2_O1/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, %rbp
movq %rdx, %r13
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x1ea7(%rip), %rsi      # 0x9358
leaq 0x50(%rsp), %rdi
callq 0x33e0
movl $0x6, %r12d
cmpb $0x1, 0x8(%rbx)
jne 0x74ed
leaq 0x1e72(%rip), %rax      # 0x9340
leaq 0x1e7b(%rip), %rsi      # 0x9350
cmpb $0x0, 0x9(%rbx)
cmovneq %rax, %rsi
leaq 0x50(%rsp), %rdi
callq 0x3050
movl $0x9, %r12d
movl $0xf000, %eax           # imm = 0xF000
andl 0x28(%rbx), %eax
cmpl $0x4000, %eax           # imm = 0x4000
jne 0x750f
leaq 0x1e5d(%rip), %rsi      # 0x9360
leaq 0x50(%rsp), %rdi
callq 0x3050
jmp 0x7565
movaps 0x1daa(%rip), %xmm0     # 0x92c0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
cmpb $0x1, 0xa9(%rbx)
jne 0x753b
movq 0x40(%rbx), %rsi
leaq 0x10(%rsp), %rdi
callq 0x73cd
leaq 0x50(%rsp), %rdi
callq 0x3280
leaq (%rsp,%rax,4), %rdi
addq $0x50, %rdi
leaq 0x1e24(%rip), %rdx      # 0x9378
leaq 0x10(%rsp), %rcx
movl $0x6, %esi
xorl %eax, %eax
callq 0x3410
movq %rbp, %r15
subq %r12, %r15
jbe 0x7655
movq %rbp, 0x28(%rsp)
movq %r13, 0x40(%rsp)
movq %r12, 0x38(%rsp)
subq %r12, %r13
movq %r13, 0x48(%rsp)
movq (%rbx), %r13
movq %r13, %rdi
callq 0x3230
movq %rax, %rbp
xorl %r12d, %r12d
xorl %ebx, %ebx
movq %r14, 0x30(%rsp)
movq %r14, 0x8(%rsp)
testq %rbp, %rbp
je 0x761a
leaq 0x10(%rsp), %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x3440
movl %eax, %r14d
testl %eax, %eax
jns 0x75cf
movl $0xfffd, 0x10(%rsp)     # imm = 0xFFFD
movl $0x1, %r14d
movl 0x10(%rsp), %edi
callq 0x3480
cmpl $-0x1, %eax
je 0x760b
movslq %eax, %rcx
addq %rbx, %rcx
movb $0x1, %al
cmpq %r15, %rcx
ja 0x760d
cmpq 0x48(%rsp), %r12
jae 0x7608
movl 0x10(%rsp), %eax
movq 0x8(%rsp), %rdx
movl %eax, (%rdx)
addq $0x4, %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, %rbx
incq %r12
xorl %eax, %eax
movl %r14d, %ecx
subq %rcx, %rbp
addq %rcx, %r13
testb %al, %al
je 0x75a5
movq 0x8(%rsp), %rax
movl $0x0, (%rax)
movq 0x38(%rsp), %r15
leaq (%r12,%r15), %rbx
movq 0x40(%rsp), %r13
cmpq %r13, %rbx
ja 0x76c0
movq 0x30(%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x3180
cltq
movq 0x28(%rsp), %rbp
jmp 0x765d
xorl %r12d, %r12d
movq %rbp, %r15
xorl %eax, %eax
addq %r15, %rax
subq %rax, %rbp
jbe 0x7685
leaq (%r12,%rbp), %rbx
leaq (%rbx,%r15), %rax
cmpq %r13, %rax
ja 0x7688
leaq (%r14,%r12,4), %rdi
movl $0x20, %esi
movq %rbp, %rdx
callq 0x3330
jmp 0x7688
movq %r12, %rbx
movl $0x0, (%r14,%rbx,4)
addq %r15, %rbx
cmpq %r13, %rbx
ja 0x76c0
leaq 0x50(%rsp), %rdi
callq 0x3280
leaq (%rsp,%rax,4), %rsi
addq $0x50, %rsi
leaq (,%r15,4), %rax
subq %rax, %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x31b0
movq %rbx, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq