// File: /workspace/github_c_makefile_star2_O1/jarun[P]nnn/src/nnn.c
// Function: redraw
static void redraw(char *path)
{
	getmaxyx(stdscr, xlines, xcols);

	int ncols = (xcols <= PATH_MAX) ? xcols : PATH_MAX;
	int i, j = 1;

	// Fast redraw
	if (g_state.move) {
		g_state.move = 0;

		if (ndents && (last_curscroll == curscroll))
			return draw_line(ncols);
	}

	DPRINTF_S(__func__);

	/* Clear screen */
	erase();

	/* Enforce scroll/cursor invariants */
	move_cursor(cur, 1);

	/* Fail redraw if < than 10 columns, context info prints 10 chars */
	if (ncols <= MIN_DISPLAY_COL) {
		printmsg(messages[MSG_FEW_COLUMNS]);
		return;
	}

	//DPRINTF_D(cur);
	DPRINTF_S(path);

	for (i = 0; i < CTX_MAX; ++i) { /* 8 chars printed for contexts - "1 2 3 4 " */
		if (!g_ctx[i].c_cfg.ctxactive)
			addch(i + '1');
		else
			addch((i + '1') | (COLOR_PAIR(i + 1) | A_BOLD
				/* active: underline, current: reverse */
				| ((cfg.curctx != i) ? A_UNDERLINE : A_REVERSE)));

		addch(' ');
	}

	attron(A_UNDERLINE | COLOR_PAIR(cfg.curctx + 1));

	/* Print path */
	bool in_home = set_tilde_in_path(path);
	char *ptr = in_home ? &path[homelen - 1] : path;

	i = (int)xstrlen(ptr);
	if ((i + MIN_DISPLAY_COL) <= ncols)
		addnstr(ptr, ncols - MIN_DISPLAY_COL);
	else {
		char *base = xmemrchr((uchar_t *)ptr, '/', i);

		if (in_home) {
			addch(*ptr);
			++ptr;
			i = 1;
		} else
			i = 0;

		if (ptr && (base != ptr)) {
			while (ptr < base) {
				if (*ptr == '/') {
					i += 2; /* 2 characters added */
					if (ncols < i + MIN_DISPLAY_COL) {
						base = NULL; /* Can't print more characters */
						break;
					}

					addch(*ptr);
					addch(*(++ptr));
				}
				++ptr;
			}
		}

		if (base)
			addnstr(base, ncols - (MIN_DISPLAY_COL + i));
	}

	if (in_home)
		reset_tilde_in_path(path);

	attroff(A_UNDERLINE | COLOR_PAIR(cfg.curctx + 1));

	/* Go to first entry */
	if (curscroll > 0) {
		move(1, 0);
#ifdef ICONS_ENABLED
		addstr(ICON_ARROW_UP);
#else
		addch('^');
#endif
	}

	if (g_state.oldcolor) {
		attron(COLOR_PAIR(cfg.curctx + 1) | A_BOLD);
		g_state.dircolor = 1;
	}

	int onscreen = MIN(ONSCREEN + curscroll, ndents);
	int len = scanselforpath(path, FALSE);

	ncols = adjust_cols(ncols);

	/* Print listing */
	for (i = curscroll; i < onscreen; ++i) {
		move(++j, 0);

		if (len)
			findmarkentry(len, &pdents[i]);

		printent(i, ncols, i == cur);
	}

	/* Must reset e.g. no files in dir */
	if (g_state.dircolor) {
		attroff(COLOR_PAIR(cfg.curctx + 1) | A_BOLD);
		g_state.dircolor = 0;
	}

	/* Go to last entry */
	if (onscreen < ndents) {
		move(xlines - 2, 0);
#ifdef ICONS_ENABLED
		addstr(ICON_ARROW_DOWN);
#else
		addch('v');
#endif
	}

	markhovered();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
movq 0x9ffa(%rip), %r12      # 0x19f90
movq (%r12), %rdi
testq %rdi, %rdi
je 0xffb5
movl 0x4(%rdi), %eax
incl %eax
movw %ax, 0xbbdd(%rip)       # 0x1bb88
movzwl 0x6(%rdi), %r13d
incl %r13d
jmp 0xffc3
movw $0xffff, 0xbbca(%rip)   # imm = 0xFFFF
movw $0xffff, %r13w          # imm = 0xFFFF
movzwl %r13w, %eax
movl $0x1000, %ecx           # imm = 0x1000
cmpl %ecx, %eax
movl %r13d, %eax
cmovael %ecx, %eax
movw %r13w, 0x142bc(%rip)    # 0x24298
movzwl %ax, %eax
movq %rax, (%rsp)
movl 0xa53b(%rip), %eax      # 0x1a524
btl $0x9, %eax
jae 0x10040
movl %eax, %ecx
andl $0xfffffdff, %ecx       # imm = 0xFFFFFDFF
movl %ecx, 0xa527(%rip)      # 0x1a524
cmpl $0x0, 0xbb88(%rip)      # 0x1bb8c
je 0x10040
movl 0x152dc(%rip), %ecx     # 0x252e8
cmpl 0x14296(%rip), %ecx     # 0x242a8
jne 0x10040
movl 0xa4ae(%rip), %ecx      # 0x1a4c8
btl $0x8, %ecx
jae 0x10037
cmpw $0x23, %r13w
ja 0x104c6
andl $0xfffffeff, %ecx       # imm = 0xFFFFFEFF
movl %ecx, 0xa491(%rip)      # 0x1a4c8
movq (%rsp), %r15
jmp 0x104ce
callq 0x40e0
movl 0x1402d(%rip), %edi     # 0x24078
movl $0x1, %esi
callq 0x11031
cmpw $0x9, %r13w
jae 0x10076
leaq 0x6009(%rip), %rdi      # 0x1606c
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xee6f
leaq 0xdc43(%rip), %rbx      # 0x1dcc0
xorl %r15d, %r15d
testb $0x2, 0x1(%rbx)
jne 0x1008c
leal 0x31(%r15), %esi
jmp 0x100b5
movl 0xa436(%rip), %eax      # 0x1a4c8
shrl $0xd, %eax
andl $0x7, %eax
xorl %ecx, %ecx
cmpq %rax, %r15
sete %cl
shll $0x11, %ecx
movl %r15d, %eax
shll $0x8, %eax
addl %ecx, %eax
leal (%r15,%rax), %esi
addl $0x220131, %esi         # imm = 0x220131
movq (%r12), %rdi
callq 0x4850
movq (%r12), %rdi
movl $0x20, %esi
callq 0x4850
incq %r15
addq $0x2138, %rbx           # imm = 0x2138
cmpq $0x4, %r15
jne 0x10080
movq (%r12), %rdi
movl 0xa3e2(%rip), %esi      # 0x1a4c8
shrl $0x5, %esi
andl $0x700, %esi            # imm = 0x700
addl $0x20100, %esi          # imm = 0x20100
xorl %edx, %edx
callq 0x4120
movq 0xa53d(%rip), %r15      # 0x1a640
movzbl 0xa53e(%rip), %ebx      # 0x1a648
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x40f0
movl %eax, %ebp
testl %eax, %eax
jne 0x1012d
movb -0x1(%r14,%rbx), %al
movb %al, (%r15,%rbx)
movb $0x7e, -0x1(%r14,%rbx)
testl %ebp, %ebp
leaq -0x1(%r14,%rbx), %r15
cmovneq %r14, %r15
xorl %ebx, %ebx
movq %r15, %rdi
xorl %esi, %esi
callq 0x4490
subq %r15, %rax
leal 0x8(%rax), %ecx
movq (%rsp), %rdx
cmpl %edx, %ecx
movq %r14, 0x18(%rsp)
jle 0x1020a
movslq %eax, %rdx
movq %r15, %rdi
movl $0x2f, %esi
callq 0x46f0
movq %rax, %r12
testl %ebp, %ebp
jne 0x1018d
movq 0x9e17(%rip), %rax      # 0x19f90
movq (%rax), %rdi
movsbl (%r15), %esi
callq 0x4850
incq %r15
movl $0x1, %ebx
testq %r15, %r15
je 0x101e7
cmpq %r15, %r12
je 0x101e7
jbe 0x101e7
movq (%rsp), %rax
addl $-0xa, %eax
movl %eax, 0x10(%rsp)
cmpb $0x2f, (%r15)
jne 0x101df
leal 0x2(%rbx), %r14d
cmpl 0x10(%rsp), %ebx
jg 0x10667
movq 0x9dd1(%rip), %rbx      # 0x19f90
movq (%rbx), %rdi
movl $0x2f, %esi
callq 0x4850
movq (%rbx), %rdi
movsbl 0x1(%r15), %esi
incq %r15
callq 0x4850
movl %r14d, %ebx
incq %r15
cmpq %r12, %r15
jb 0x101a4
movl %ebx, %r14d
testq %r12, %r12
je 0x10219
movq 0x9d9a(%rip), %rax      # 0x19f90
movq (%rax), %rdi
movq (%rsp), %rax
movl %eax, %edx
subl %r14d, %edx
addl $-0x8, %edx
movq %r12, %rsi
jmp 0x10214
movq (%r12), %rdi
addl $-0x8, %edx
movq %r15, %rsi
callq 0x41c0
testl %ebp, %ebp
movq 0x18(%rsp), %r14
jne 0x1023c
movq 0xa417(%rip), %rax      # 0x1a640
movzbl 0xa418(%rip), %ecx      # 0x1a648
movb (%rax,%rcx), %dl
movb %dl, -0x1(%r14,%rcx)
movb $0x0, (%rax,%rcx)
movq 0x9d4d(%rip), %rbx      # 0x19f90
movq (%rbx), %rdi
movl 0xa27c(%rip), %esi      # 0x1a4c8
shrl $0x5, %esi
andl $0x700, %esi            # imm = 0x700
addl $0x20100, %esi          # imm = 0x20100
xorl %edx, %edx
callq 0x4730
cmpl $0x0, 0x1403f(%rip)     # 0x242a8
jle 0x10287
movq (%rbx), %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x4070
movq (%rbx), %rdi
movl $0x5e, %esi
callq 0x4850
testb $0x4, 0xa297(%rip)      # 0x1a525
je 0x102b6
movq (%rbx), %rdi
movl 0xa22f(%rip), %esi      # 0x1a4c8
shrl $0x5, %esi
andl $0x700, %esi            # imm = 0x700
addl $0x200100, %esi         # imm = 0x200100
xorl %edx, %edx
callq 0x4120
orb $0x4, 0xa26e(%rip)      # 0x1a524
movzwl 0xb8cb(%rip), %eax      # 0x1bb88
movl 0x13fe5(%rip), %ecx     # 0x242a8
addl %ecx, %eax
addl $-0x4, %eax
movl 0xb8be(%rip), %ecx      # 0x1bb8c
cmpl %ecx, %eax
cmovll %eax, %ecx
movl %ecx, 0xc(%rsp)
movq %r14, %rdi
xorl %esi, %esi
callq 0x1201b
movl %eax, 0x18(%rsp)
movl 0xa1dd(%rip), %eax      # 0x1a4c8
btl $0x8, %eax
jae 0x10303
cmpw $0x23, %r13w
ja 0x10309
andl $0xfffffeff, %eax       # imm = 0xFFFFFEFF
movl %eax, 0xa1c5(%rip)      # 0x1a4c8
movq (%rsp), %rbx
jmp 0x10310
movq (%rsp), %rbx
addl $-0x20, %ebx
movl 0xc(%rsp), %r13d
movl 0x13f8c(%rip), %r14d    # 0x242a8
cmpl %r13d, %r14d
jge 0x1042b
addl $-0x2, %ebx
movslq %r14d, %rax
movslq 0x18(%rsp), %rcx
leaq 0x13f89(%rip), %rdx     # 0x242c0
addq %rcx, %rdx
movq %rdx, 0x10(%rsp)
subq %rdx, %rcx
movq %rcx, 0x20(%rsp)
leaq (%rax,%rax,2), %rbp
shlq $0x4, %rbp
addq $0x20, %rbp
movl $0x2, %r12d
movq %rbx, (%rsp)
movq 0x9c2c(%rip), %rax      # 0x19f90
movq (%rax), %rdi
movl %r12d, %esi
xorl %edx, %edx
callq 0x4070
cmpl $0x0, 0x18(%rsp)
je 0x10402
movq 0x13ced(%rip), %r15     # 0x24070
movq (%r15,%rbp), %rax
movabsq $0x2000000000000000, %rcx # imm = 0x2000000000000000
testq %rcx, %rax
jne 0x10402
movq 0x14f23(%rip), %r13     # 0x252c0
movq -0x20(%r15,%rbp), %rsi
shrq $0x28, %rax
movzwl %ax, %ebx
movq 0x10(%rsp), %rdi
xorl %edx, %edx
movq %rbx, %rcx
callq 0x4860
testq %rax, %rax
jne 0x103d2
testq %rbx, %rbx
movq 0x10(%rsp), %rax
je 0x103cc
movb $0x0, -0x1(%rax,%rbx)
addq %rax, %rbx
movq %rbx, %rax
addl 0x20(%rsp), %eax
movq %r13, %rdi
movl %eax, %esi
callq 0x13518
testq %rax, %rax
je 0x103eb
orb $0x10, 0x7(%r15,%rbp)
movabsq $0x2000000000000000, %rax # imm = 0x2000000000000000
orq %rax, (%r15,%rbp)
movq (%rsp), %rbx
movl 0xc(%rsp), %r13d
xorl %edx, %edx
cmpl 0x13c6d(%rip), %r14d    # 0x24078
sete %dl
movl %r14d, %edi
movl %ebx, %esi
callq 0x13094
incl %r14d
addq $0x30, %rbp
incl %r12d
cmpl %r14d, %r13d
jne 0x1035d
testb $0x4, 0xa0f2(%rip)      # 0x1a524
movq 0x9b57(%rip), %rbx      # 0x19f90
je 0x10461
movq (%rbx), %rdi
movl 0xa084(%rip), %esi      # 0x1a4c8
shrl $0x5, %esi
andl $0x700, %esi            # imm = 0x700
addl $0x200100, %esi         # imm = 0x200100
xorl %edx, %edx
callq 0x4730
andb $-0x5, 0xa0c3(%rip)     # 0x1a524
cmpl 0xb724(%rip), %r13d     # 0x1bb8c
jge 0x1048b
movq (%rbx), %rdi
movzwl 0xb714(%rip), %esi      # 0x1bb88
addl $-0x2, %esi
xorl %edx, %edx
callq 0x4070
movq (%rbx), %rdi
movl $0x76, %esi
callq 0x4850
testb $0x1, 0xa037(%rip)      # 0x1a4c9
je 0x10658
cmpl $0x0, 0xb6ed(%rip)      # 0x1bb8c
je 0x10658
movq (%rbx), %rdi
movl 0x13bca(%rip), %esi     # 0x24078
subl 0x13df4(%rip), %esi     # 0x242a8
addl $0x2, %esi
xorl %edx, %edx
callq 0x4070
movq (%rbx), %rdi
jmp 0x10640
movq (%rsp), %r15
addl $-0x20, %r15d
movabsq $0x100000000000000, %r14 # imm = 0x100000000000000
addl $-0x2, %r15d
btl $0xa, %eax
jae 0x104ff
movq 0x13b87(%rip), %rax     # 0x24070
movslq 0x14e70(%rip), %rcx     # 0x25360
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
testq %r14, 0x20(%rax,%rcx)
jne 0x10503
xorl %ebx, %ebx
jmp 0x10521
movl 0x9fbf(%rip), %esi      # 0x1a4c8
shrl $0x5, %esi
andl $0x700, %esi            # imm = 0x700
addl $0x200100, %esi         # imm = 0x200100
xorl %edx, %edx
callq 0x4120
movb $0x1, %bl
movq (%r12), %rdi
movl 0x14e35(%rip), %esi     # 0x25360
subl 0x13d77(%rip), %esi     # 0x242a8
addl $0x2, %esi
xorl %edx, %edx
callq 0x4070
movl 0x14e1f(%rip), %edi     # 0x25360
movl %r15d, %esi
xorl %edx, %edx
callq 0x13094
testb $0x4, 0x9fd3(%rip)      # 0x1a525
je 0x10571
movq 0x13b15(%rip), %rax     # 0x24070
movslq 0x13b16(%rip), %rcx     # 0x24078
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
testq %r14, 0x20(%rax,%rcx)
jne 0x10599
testb %bl, %bl
je 0x105bf
movq (%r12), %rdi
movl 0x9f49(%rip), %esi      # 0x1a4c8
shrl $0x5, %esi
andl $0x700, %esi            # imm = 0x700
addl $0x200100, %esi         # imm = 0x200100
xorl %ebx, %ebx
xorl %edx, %edx
callq 0x4730
jmp 0x105bf
testb %bl, %bl
jne 0x105bf
movq (%r12), %rdi
movl 0x9f21(%rip), %esi      # 0x1a4c8
shrl $0x5, %esi
andl $0x700, %esi            # imm = 0x700
addl $0x200100, %esi         # imm = 0x200100
xorl %edx, %edx
callq 0x4120
movb $0x1, %bl
movq (%r12), %rdi
movl 0x13aaf(%rip), %esi     # 0x24078
subl 0x13cd9(%rip), %esi     # 0x242a8
addl $0x2, %esi
xorl %edx, %edx
callq 0x4070
movl 0x13a99(%rip), %edi     # 0x24078
movl %r15d, %esi
movl $0x1, %edx
callq 0x13094
testb %bl, %bl
je 0x10610
movq (%r12), %rdi
movl 0x9ece(%rip), %esi      # 0x1a4c8
shrl $0x5, %esi
andl $0x700, %esi            # imm = 0x700
addl $0x200100, %esi         # imm = 0x200100
xorl %edx, %edx
callq 0x4730
testb $0x1, 0x9eb2(%rip)      # 0x1a4c9
je 0x10658
cmpl $0x0, 0xb56c(%rip)      # 0x1bb8c
je 0x10658
movq (%r12), %rdi
movl 0x13a4c(%rip), %esi     # 0x24078
subl 0x13c76(%rip), %esi     # 0x242a8
addl $0x2, %esi
xorl %edx, %edx
callq 0x4070
movq (%r12), %rdi
movl $0x20003e, %esi         # imm = 0x20003E
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4850
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r12d, %r12d
jmp 0x101ea