// File: /workspace/github_c_makefile_star2_O3/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 0x2032(%rip), %rsi      # 0x9348
leaq 0x50(%rsp), %rdi
callq 0x33e0
movl $0x6, %r14d
cmpb $0x1, 0x8(%rbx)
jne 0x7352
leaq 0x1ffd(%rip), %rax      # 0x9330
leaq 0x2006(%rip), %rsi      # 0x9340
cmpb $0x0, 0x9(%rbx)
cmovneq %rax, %rsi
leaq 0x50(%rsp), %rdi
callq 0x3050
movl $0x9, %r14d
movl $0xf000, %eax           # imm = 0xF000
andl 0x28(%rbx), %eax
cmpl $0x4000, %eax           # imm = 0x4000
jne 0x7374
leaq 0x1fe8(%rip), %rsi      # 0x9350
leaq 0x50(%rsp), %rdi
callq 0x3050
jmp 0x73ca
movaps 0x1f35(%rip), %xmm0     # 0x92b0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
cmpb $0x1, 0xa9(%rbx)
jne 0x73a0
movq 0x40(%rbx), %rsi
leaq 0x10(%rsp), %rdi
callq 0x725c
leaq 0x50(%rsp), %rdi
callq 0x3280
leaq (%rsp,%rax,4), %rdi
addq $0x50, %rdi
leaq 0x1faf(%rip), %rdx      # 0x9368
leaq 0x10(%rsp), %rcx
movl $0x6, %esi
xorl %eax, %eax
callq 0x3410
movq %r15, %rax
subq %r14, %rax
movq %rax, 0x48(%rsp)
jbe 0x7486
movq %r15, 0x30(%rsp)
movq %r14, (%rsp)
movq %r13, 0x8(%rsp)
movq (%rbx), %r13
movq %r13, %rdi
callq 0x3230
testq %rax, %rax
movq %r12, 0x38(%rsp)
je 0x7490
movq %rax, %rbp
movq 0x8(%rsp), %rax
subq (%rsp), %rax
movq %rax, 0x40(%rsp)
xorl %ebx, %ebx
movq %r12, %r15
xorl %r14d, %r14d
leaq 0x10(%rsp), %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x3440
testl %eax, %eax
js 0x7438
movl 0x10(%rsp), %edi
movl %eax, %r12d
jmp 0x744b
movl $0xfffd, 0x10(%rsp)     # imm = 0xFFFD
movl $0x1, %r12d
movl $0xfffd, %edi           # imm = 0xFFFD
callq 0x3480
cmpl $-0x1, %eax
je 0x7479
cltq
addq %rbx, %rax
cmpq 0x48(%rsp), %rax
ja 0x7496
cmpq 0x40(%rsp), %r14
jae 0x7476
movl 0x10(%rsp), %ecx
movl %ecx, (%r15)
addq $0x4, %r15
movq %rax, %rbx
incq %r14
subq %r12, %rbp
addq %r12, %r13
testq %rbp, %rbp
jne 0x741b
jmp 0x7496
xorl %r14d, %r14d
movq %r15, %rbp
xorl %eax, %eax
jmp 0x74c6
xorl %r14d, %r14d
movq %r12, %r15
movl $0x0, (%r15)
movq (%rsp), %rbp
leaq (%r14,%rbp), %rbx
movq 0x8(%rsp), %r13
cmpq %r13, %rbx
ja 0x7529
movq 0x38(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x3180
cltq
movq 0x30(%rsp), %r15
addq %rbp, %rax
subq %rax, %r15
jbe 0x74f0
movq %r15, %rdx
addq %r14, %r15
leaq (%r15,%rbp), %rbx
cmpq %r13, %rbx
ja 0x74eb
leaq (%r12,%r14,4), %rdi
movl $0x20, %esi
callq 0x3330
movq %r15, %r14
jmp 0x74f4
leaq (%r14,%rbp), %rbx
movl $0x0, (%r12,%r14,4)
cmpq %r13, %rbx
ja 0x7529
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