// File: /workspace/github_c_makefile_star2_O0/cglindkamp[P]dfm/src/application.c
// Function: refresh_statusbar
static void refresh_statusbar(struct application *app)
{
	werase(app->status);
	if(listmodel_count(&app->model.listmodel) > 0) {
		size_t count = listmodel_count(&app->model.listmodel);
		size_t pos = listview_getindex(&app->view) + 1;

		size_t dsize = dirmodel_getdirsize(&app->model);
		wchar_t dirsize[INFO_SIZE_DIR_LENGTH + 1];
		filesize_to_string(dirsize, dsize);

		struct marked_stats mstats = dirmodel_getmarkedstats(&app->model);
		wchar_t markedsize[INFO_SIZE_DIR_LENGTH + 1];

		filesize_to_string(markedsize, mstats.size);

		size_t markedstatswidth = snprintf(NULL, 0, " (%zu %ls)", mstats.count, markedsize);
		char markedstats[markedstatswidth + 1];

		if(mstats.count > 0)
			sprintf(markedstats, " (%zu %ls)", mstats.count, markedsize);
		else {
			markedstats[0] = '\0';
			markedstatswidth = 0;
		}

		size_t rightwidth = snprintf(NULL, 0, " %zu/%zu %ls%s", pos, count, dirsize, markedstats);
		char right[rightwidth + 1];

		sprintf(right, " %zu/%zu %ls%s", pos, count, dirsize, markedstats);

		size_t width = getmaxx(app->status);
		if(rightwidth >= width) {
			mvwprintw(app->status, 0, 0, "%s", right + rightwidth - width);
		} else {
			const struct filedata *filedata = dirmodel_getfiledata(&app->model, listview_getindex(&app->view));
			char left [FILEDATA_FORMAT_OUTPUT_BUFFER_SIZE];

			filedata_format_output(filedata, left);
			wprintw(app->status, "%s", left);

			mvwprintw(app->status, 0, width - rightwidth, "%s", right);
		}

		if(markedstatswidth > 0) {
			int colorstart = width - markedstatswidth + 1;
			int colorwidth = markedstatswidth - 1;
			if(colorstart < 0) {
				colorwidth += colorstart;
				colorstart = 0;
			}
			mvwchgat(app->status, 0, colorstart, colorwidth, 0, 2, NULL);
		}
	}
	wrefresh(app->status);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0xf0(%rax), %rdi
callq 0x30e0
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
callq 0xa660
cmpq $0x0, %rax
jbe 0x58d3
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
callq 0xa660
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0xafa0
incq %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
callq 0x82c0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x9880
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
callq 0x78d0
movq %rax, -0x50(%rbp)
movq %rdx, -0x48(%rbp)
movq -0x48(%rbp), %rsi
leaq -0x70(%rbp), %rdi
movq %rdi, -0x128(%rbp)
callq 0x9880
movq -0x128(%rbp), %r8
movq -0x50(%rbp), %rcx
leaq 0x7b05(%rip), %rdx      # 0xd115
xorl %eax, %eax
movl %eax, %esi
movq %rsi, %rdi
callq 0x32a0
cltq
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rdx
movq %rdx, %rax
incq %rax
movq %rsp, %rcx
movq %rcx, -0x80(%rbp)
addq $0x10, %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x120(%rbp)
movq %rcx, %rsp
movq %rax, -0x88(%rbp)
cmpq $0x0, -0x50(%rbp)
jbe 0x5678
movq -0x120(%rbp), %rdi
movq -0x50(%rbp), %rdx
leaq -0x70(%rbp), %rcx
leaq 0x7aa6(%rip), %rsi      # 0xd115
movb $0x0, %al
callq 0x3680
jmp 0x568a
movq -0x120(%rbp), %rax
movb $0x0, (%rax)
movq $0x0, -0x78(%rbp)
movq -0x120(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %r8
subq $0x10, %rsp
movq %rsp, %rax
movq %rdx, (%rax)
leaq 0x7a76(%rip), %rdx      # 0xd120
xorl %eax, %eax
movl %eax, %esi
leaq -0x40(%rbp), %r9
movq %rsi, %rdi
callq 0x32a0
movq -0x120(%rbp), %r9
addq $0x10, %rsp
cltq
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rcx
movq %rcx, %rax
incq %rax
addq $0x10, %rcx
andq $-0x10, %rcx
movq %rsp, %rdi
subq %rcx, %rdi
movq %rdi, -0x130(%rbp)
movq %rdi, %rsp
movq %rax, -0x98(%rbp)
movq -0x18(%rbp), %rdx
movq -0x10(%rbp), %rcx
leaq -0x40(%rbp), %r8
leaq 0x7a13(%rip), %rsi      # 0xd120
movb $0x0, %al
callq 0x3680
movq -0x8(%rbp), %rcx
xorl %eax, %eax
cmpq 0xf0(%rcx), %rax
je 0x573d
movq -0x8(%rbp), %rax
movq 0xf0(%rax), %rax
movswl 0x6(%rax), %eax
addl $0x1, %eax
movl %eax, -0x134(%rbp)
jmp 0x574a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x134(%rbp)
jmp 0x574a
movl -0x134(%rbp), %eax
cltq
movq %rax, -0xa0(%rbp)
movq -0x90(%rbp), %rax
cmpq -0xa0(%rbp), %rax
jb 0x57a5
movq -0x130(%rbp), %r8
movq -0x8(%rbp), %rax
movq 0xf0(%rax), %rdi
addq -0x90(%rbp), %r8
xorl %eax, %eax
subq -0xa0(%rbp), %rax
addq %rax, %r8
xorl %edx, %edx
leaq 0x7995(%rip), %rcx      # 0xd12c
movl %edx, %esi
movb $0x0, %al
callq 0x3260
jmp 0x5838
movq -0x8(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x140(%rbp)
movq -0x8(%rbp), %rdi
callq 0xafa0
movq -0x140(%rbp), %rdi
movq %rax, %rsi
callq 0x8290
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x95a0
movq -0x8(%rbp), %rax
movq 0xf0(%rax), %rdi
leaq -0x110(%rbp), %rdx
leaq 0x792d(%rip), %rsi      # 0xd12c
movb $0x0, %al
callq 0x3730
movq -0x130(%rbp), %r8
movq -0x8(%rbp), %rax
movq 0xf0(%rax), %rdi
movq -0xa0(%rbp), %rax
subq -0x90(%rbp), %rax
movl %eax, %edx
xorl %esi, %esi
leaq 0x78fb(%rip), %rcx      # 0xd12c
movb $0x0, %al
callq 0x3260
cmpq $0x0, -0x78(%rbp)
jbe 0x58cc
movq -0xa0(%rbp), %rax
subq -0x78(%rbp), %rax
addq $0x1, %rax
movl %eax, -0x114(%rbp)
movq -0x78(%rbp), %rax
subq $0x1, %rax
movl %eax, -0x118(%rbp)
cmpl $0x0, -0x114(%rbp)
jge 0x588b
movl -0x114(%rbp), %eax
addl -0x118(%rbp), %eax
movl %eax, -0x118(%rbp)
movl $0x0, -0x114(%rbp)
movq -0x8(%rbp), %rax
movq 0xf0(%rax), %rdi
movl -0x114(%rbp), %edx
xorl %esi, %esi
callq 0x3090
cmpl $-0x1, %eax
jne 0x58aa
jmp 0x58cc
movq -0x8(%rbp), %rax
movq 0xf0(%rax), %rdi
movl -0x118(%rbp), %esi
xorl %edx, %edx
movl $0x2, %ecx
xorl %eax, %eax
movl %eax, %r8d
callq 0x31d0
movq -0x80(%rbp), %rax
movq %rax, %rsp
movq -0x8(%rbp), %rax
movq 0xf0(%rax), %rdi
callq 0x3390
movq %rbp, %rsp
popq %rbp
retq
nopl (%rax,%rax)