// File: /workspace/github_c_makefile_star2_O3/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, %rbx
movq 0xa22a(%rip), %r15      # 0x19f90
movq (%r15), %rdi
testq %rdi, %rdi
je 0xfd7d
movl 0x4(%rdi), %eax
incl %eax
movzwl 0x6(%rdi), %r13d
incl %r13d
jmp 0xfd86
movw $0xffff, %ax            # imm = 0xFFFF
movw $0xffff, %r13w          # imm = 0xFFFF
movw %ax, 0xbdfb(%rip)       # 0x1bb88
movzwl %r13w, %eax
movl $0x1000, %ecx           # imm = 0x1000
cmpl %ecx, %eax
movl %r13d, %eax
cmovael %ecx, %eax
movw %r13w, 0x144f2(%rip)    # 0x24298
movzwl %ax, %r12d
movl 0xa774(%rip), %eax      # 0x1a524
btl $0x9, %eax
jae 0xfe07
movl %eax, %ecx
andl $0xfffffdff, %ecx       # imm = 0xFFFFFDFF
movl %ecx, 0xa760(%rip)      # 0x1a524
cmpl $0x0, 0xbdc1(%rip)      # 0x1bb8c
je 0xfe07
movl 0x15515(%rip), %ecx     # 0x252e8
cmpl 0x144cf(%rip), %ecx     # 0x242a8
jne 0xfe07
movl 0xa6e7(%rip), %esi      # 0x1a4c8
btl $0x8, %esi
jae 0x102b2
cmpw $0x23, %r13w
ja 0x102ae
andl $0xfffffeff, %esi       # imm = 0xFFFFFEFF
movl %esi, 0xa6c6(%rip)      # 0x1a4c8
jmp 0x102b2
callq 0x40e0
movl 0x14266(%rip), %edi     # 0x24078
movl $0x1, %esi
callq 0x10e3c
cmpw $0x9, %r13w
jae 0xfe3d
leaq 0x625c(%rip), %rdi      # 0x16086
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xec60
movq %rbx, 0x10(%rsp)
movq %r12, 0x8(%rsp)
leaq 0xde72(%rip), %rbx      # 0x1dcc0
xorl %r14d, %r14d
testb $0x2, 0x1(%rbx)
jne 0xfe5d
leal 0x31(%r14), %esi
jmp 0xfe86
movl 0xa665(%rip), %eax      # 0x1a4c8
shrl $0xd, %eax
andl $0x7, %eax
xorl %ecx, %ecx
cmpq %rax, %r14
sete %cl
shll $0x11, %ecx
movl %r14d, %eax
shll $0x8, %eax
addl %ecx, %eax
leal (%r14,%rax), %esi
addl $0x220131, %esi         # imm = 0x220131
movq (%r15), %rdi
callq 0x4850
movq (%r15), %rdi
movl $0x20, %esi
callq 0x4850
incq %r14
addq $0x2138, %rbx           # imm = 0x2138
cmpq $0x4, %r14
jne 0xfe51
movq (%r15), %rdi
movl 0xa614(%rip), %esi      # 0x1a4c8
shrl $0x5, %esi
andl $0x700, %esi            # imm = 0x700
addl $0x20100, %esi          # imm = 0x20100
xorl %edx, %edx
callq 0x4120
movq 0xa76f(%rip), %rbx      # 0x1a640
movzbl 0xa76f(%rip), %r12d     # 0x1a648
movq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x40f0
movl %eax, %ebp
testl %eax, %eax
jne 0xff01
movb -0x1(%r14,%r12), %cl
movb %cl, (%rbx,%r12)
movb $0x7e, -0x1(%r14,%r12)
testl %ebp, %ebp
leaq -0x1(%r14,%r12), %rax
movq %r14, %r15
movq %rax, (%rsp)
cmoveq %rax, %r15
xorl %ebx, %ebx
movq %r15, %rdi
xorl %esi, %esi
callq 0x4490
subq %r15, %rax
leal 0x8(%rax), %ecx
movq 0x8(%rsp), %rdx
cmpl %edx, %ecx
movl %ebp, 0x18(%rsp)
jle 0xffc3
movslq %eax, %rdx
movq %r15, %rdi
movl $0x2f, %esi
callq 0x46f0
movq %rax, %r15
testl %ebp, %ebp
jne 0xff70
addq 0x10(%rsp), %r12
movq 0xa037(%rip), %rax      # 0x19f90
movq (%rax), %rdi
movq (%rsp), %rax
movsbl (%rax), %esi
callq 0x4850
movl $0x1, %ebx
movq %r12, %r14
testq %r14, %r14
je 0xffd3
cmpq %r14, %r15
movq 0xa011(%rip), %rbp      # 0x19f90
je 0xffda
jbe 0xffda
movq 0x8(%rsp), %rax
leal -0xa(%rax), %r12d
cmpb $0x2f, (%r14)
jne 0xffb9
cmpl %r12d, %ebx
jg 0xfff7
addl $0x2, %ebx
movq (%rbp), %rdi
movl $0x2f, %esi
callq 0x4850
movq (%rbp), %rdi
movsbl 0x1(%r14), %esi
incq %r14
callq 0x4850
incq %r14
cmpq %r15, %r14
jb 0xff8c
jmp 0xffda
movq 0x9fc6(%rip), %rbp      # 0x19f90
movq (%rbp), %rdi
addl $-0x8, %edx
jmp 0xffef
movq 0x9fb6(%rip), %rbp      # 0x19f90
testq %r15, %r15
je 0xfff7
movq (%rbp), %rdi
movq 0x8(%rsp), %rax
movl %eax, %edx
subl %ebx, %edx
addl $-0x8, %edx
movq %r15, %rsi
callq 0x41c0
cmpl $0x0, 0x18(%rsp)
movq 0x10(%rsp), %r14
jne 0x1001d
movq 0xa636(%rip), %rax      # 0x1a640
movzbl 0xa637(%rip), %ecx      # 0x1a648
movb (%rax,%rcx), %dl
movb %dl, -0x1(%r14,%rcx)
movb $0x0, (%rax,%rcx)
movq (%rbp), %rdi
movl 0xa4a1(%rip), %esi      # 0x1a4c8
shrl $0x5, %esi
andl $0x700, %esi            # imm = 0x700
addl $0x20100, %esi          # imm = 0x20100
xorl %edx, %edx
callq 0x4730
cmpl $0x0, 0x14264(%rip)     # 0x242a8
movq 0x8(%rsp), %rbx
jle 0x10069
movq (%rbp), %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x4070
movq (%rbp), %rdi
movl $0x5e, %esi
callq 0x4850
testb $0x4, 0xa4b5(%rip)      # 0x1a525
je 0x10099
movq (%rbp), %rdi
movl 0xa44c(%rip), %esi      # 0x1a4c8
shrl $0x5, %esi
andl $0x700, %esi            # imm = 0x700
addl $0x200100, %esi         # imm = 0x200100
xorl %edx, %edx
callq 0x4120
orb $0x4, 0xa48b(%rip)      # 0x1a524
movzwl 0xbae8(%rip), %eax      # 0x1bb88
movl 0x14202(%rip), %ecx     # 0x242a8
addl %ecx, %eax
addl $-0x4, %eax
movl 0xbadb(%rip), %ecx      # 0x1bb8c
cmpl %ecx, %eax
cmovll %eax, %ecx
movl %ecx, (%rsp)
movq %r14, %rdi
xorl %esi, %esi
callq 0x11cc8
movl %eax, 0x10(%rsp)
movl 0xa3fb(%rip), %eax      # 0x1a4c8
btl $0x8, %eax
jae 0x100ea
cmpw $0x23, %r13w
ja 0x100e7
andl $0xfffffeff, %eax       # imm = 0xFFFFFEFF
movl %eax, 0xa3e3(%rip)      # 0x1a4c8
jmp 0x100ea
addl $-0x20, %ebx
movl (%rsp), %r13d
movl 0x141b3(%rip), %r14d    # 0x242a8
cmpl %r13d, %r14d
jge 0x10210
addl $-0x2, %ebx
movslq %r14d, %rax
movslq 0x10(%rsp), %rcx
leaq 0x141b0(%rip), %rdx     # 0x242c0
addq %rcx, %rdx
movq %rdx, 0x18(%rsp)
subq %rdx, %rcx
movq %rcx, 0x20(%rsp)
leaq (%rax,%rax,2), %rbp
shlq $0x4, %rbp
addq $0x20, %rbp
movl $0x2, %r12d
movq %rbx, 0x8(%rsp)
movq 0x9e52(%rip), %rax      # 0x19f90
movq (%rax), %rdi
movl %r12d, %esi
xorl %edx, %edx
callq 0x4070
cmpl $0x0, 0x10(%rsp)
je 0x101e7
movq 0x13f13(%rip), %r15     # 0x24070
movq (%r15,%rbp), %rax
movabsq $0x2000000000000000, %rcx # imm = 0x2000000000000000
testq %rcx, %rax
jne 0x101e7
movq 0x15149(%rip), %r13     # 0x252c0
movq -0x20(%r15,%rbp), %rsi
shrq $0x28, %rax
movzwl %ax, %ebx
movq 0x18(%rsp), %rdi
xorl %edx, %edx
movq %rbx, %rcx
callq 0x4860
testq %rax, %rax
jne 0x101ac
testq %rbx, %rbx
movq 0x18(%rsp), %rax
je 0x101a6
movb $0x0, -0x1(%rax,%rbx)
addq %rax, %rbx
movq %rbx, %rax
addl 0x20(%rsp), %eax
movq %r13, %rdi
movl %eax, %esi
callq 0x131ca
movq (%r15,%rbp), %rcx
movq %rcx, %rdx
btsq $0x3c, %rdx
testq %rax, %rax
cmoveq %rcx, %rdx
movabsq $0x2000000000000000, %rax # imm = 0x2000000000000000
orq %rax, %rdx
movq %rdx, (%r15,%rbp)
movq 0x8(%rsp), %rbx
movl (%rsp), %r13d
xorl %edx, %edx
cmpl 0x13e88(%rip), %r14d    # 0x24078
sete %dl
movl %r14d, %edi
movl %ebx, %esi
callq 0x12d2a
incl %r14d
addq $0x30, %rbp
incl %r12d
cmpl %r14d, %r13d
jne 0x10137
testb $0x4, 0xa30d(%rip)      # 0x1a524
movq 0x9d72(%rip), %rbx      # 0x19f90
je 0x10246
movq (%rbx), %rdi
movl 0xa29f(%rip), %esi      # 0x1a4c8
shrl $0x5, %esi
andl $0x700, %esi            # imm = 0x700
addl $0x200100, %esi         # imm = 0x200100
xorl %edx, %edx
callq 0x4730
andb $-0x5, 0xa2de(%rip)     # 0x1a524
movl 0xb940(%rip), %eax      # 0x1bb8c
cmpl %eax, %r13d
jge 0x10278
movq (%rbx), %rdi
movzwl 0xb92d(%rip), %esi      # 0x1bb88
addl $-0x2, %esi
xorl %edx, %edx
callq 0x4070
movq (%rbx), %rdi
movl $0x76, %esi
callq 0x4850
movl 0xb914(%rip), %eax      # 0x1bb8c
testb $0x1, 0xa24a(%rip)      # 0x1a4c9
je 0x10435
testl %eax, %eax
je 0x10435
movq (%rbx), %rdi
movl 0x13de2(%rip), %esi     # 0x24078
subl 0x1400c(%rip), %esi     # 0x242a8
addl $0x2, %esi
xorl %edx, %edx
callq 0x4070
movq (%rbx), %rdi
jmp 0x1041d
addl $-0x20, %r12d
movabsq $0x100000000000000, %r14 # imm = 0x100000000000000
addl $-0x2, %r12d
btl $0xa, %eax
movl 0x15096(%rip), %eax     # 0x25360
jae 0x102e5
movslq %eax, %rdx
movq 0x13d9a(%rip), %r8      # 0x24070
leaq (%rdx,%rdx,2), %rdx
shlq $0x4, %rdx
testq %r14, 0x20(%r8,%rdx)
jne 0x102e9
xorl %ebx, %ebx
jmp 0x10310
shrl $0x5, %esi
andl $0x700, %esi            # imm = 0x700
addl $0x200100, %esi         # imm = 0x200100
xorl %edx, %edx
callq 0x4120
movl 0x1505b(%rip), %eax     # 0x25360
movq (%r15), %rdi
movb $0x1, %bl
movl 0x13f98(%rip), %ecx     # 0x242a8
subl %ecx, %eax
addl $0x2, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x4070
movl 0x1503c(%rip), %edi     # 0x25360
movl %r12d, %esi
xorl %edx, %edx
callq 0x12d2a
testb $0x4, 0xa1f0(%rip)      # 0x1a525
je 0x10354
movq 0x13d32(%rip), %rax     # 0x24070
movslq 0x13d33(%rip), %rcx     # 0x24078
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
testq %r14, 0x20(%rax,%rcx)
jne 0x1037b
testb %bl, %bl
je 0x103a0
movq (%r15), %rdi
movl 0xa167(%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 0x103a0
testb %bl, %bl
jne 0x103a0
movq (%r15), %rdi
movl 0xa140(%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 (%r15), %rdi
movl 0x13ccf(%rip), %esi     # 0x24078
subl 0x13ef9(%rip), %esi     # 0x242a8
addl $0x2, %esi
xorl %edx, %edx
callq 0x4070
movl 0x13cb9(%rip), %edi     # 0x24078
movl %r12d, %esi
movl $0x1, %edx
callq 0x12d2a
testb %bl, %bl
je 0x103ef
movq (%r15), %rdi
movl 0xa0ef(%rip), %esi      # 0x1a4c8
shrl $0x5, %esi
andl $0x700, %esi            # imm = 0x700
addl $0x200100, %esi         # imm = 0x200100
xorl %edx, %edx
callq 0x4730
testb $0x1, 0xa0d3(%rip)      # 0x1a4c9
je 0x10435
cmpl $0x0, 0xb78d(%rip)      # 0x1bb8c
je 0x10435
movq (%r15), %rdi
movl 0x13c6e(%rip), %esi     # 0x24078
subl 0x13e98(%rip), %esi     # 0x242a8
addl $0x2, %esi
xorl %edx, %edx
callq 0x4070
movq (%r15), %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