// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
xorl %eax, %eax
movq 0x1109b(%rip), %rcx     # 0x1ff90
cmpq (%rcx), %rax
je 0xef10
movq 0x1108f(%rip), %rax     # 0x1ff90
movq (%rax), %rax
movswl 0x4(%rax), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xef1a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x34(%rbp)
jmp 0xef1a
movl -0x34(%rbp), %eax
movw %ax, 0x12f64(%rip)      # 0x21e88
xorl %eax, %eax
movq 0x11063(%rip), %rcx     # 0x1ff90
cmpq (%rcx), %rax
je 0xef48
movq 0x11057(%rip), %rax     # 0x1ff90
movq (%rax), %rax
movswl 0x6(%rax), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0xef52
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x38(%rbp)
jmp 0xef52
movl -0x38(%rbp), %eax
movw %ax, 0x1b63c(%rip)      # 0x2a598
movzwl 0x1b635(%rip), %eax     # 0x2a598
cmpl $0x1000, %eax           # imm = 0x1000
jg 0xef76
movzwl 0x1b627(%rip), %eax     # 0x2a598
movl %eax, -0x3c(%rbp)
jmp 0xef80
movl $0x1000, %eax           # imm = 0x1000
movl %eax, -0x3c(%rbp)
jmp 0xef80
movl -0x3c(%rbp), %eax
movl %eax, -0xc(%rbp)
movl $0x1, -0x14(%rbp)
movl 0x11891(%rip), %eax     # 0x20824
shrl $0x9, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xefd8
movl 0x11880(%rip), %eax     # 0x20824
andl $0xfffffdff, %eax       # imm = 0xFFFFFDFF
orl $0x0, %eax
movl %eax, 0x11872(%rip)     # 0x20824
cmpl $0x0, 0x12ed3(%rip)     # 0x21e8c
je 0xefd6
movl 0x1c627(%rip), %eax     # 0x2b5e8
cmpl 0x1b5e1(%rip), %eax     # 0x2a5a8
jne 0xefd6
movl -0xc(%rbp), %edi
callq 0x17570
jmp 0xf4a2
jmp 0xefd8
movq 0x10fb1(%rip), %rax     # 0x1ff90
movq (%rax), %rdi
callq 0x40e0
movl 0x1b38b(%rip), %edi     # 0x2a378
movl $0x1, %esi
callq 0x10360
cmpl $0x8, -0xc(%rbp)
jg 0xf00e
movq 0x10b44(%rip), %rdi     # 0x1fb48
callq 0xd020
jmp 0xf4a2
movl $0x0, -0x10(%rbp)
cmpl $0x4, -0x10(%rbp)
jge 0xf0cd
movslq -0x10(%rbp), %rcx
leaq 0x12e66(%rip), %rax     # 0x21e90
imulq $0x2138, %rcx, %rcx     # imm = 0x2138
addq %rcx, %rax
movl 0x2130(%rax), %eax
shrl $0x9, %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0xf05c
movq 0x10f44(%rip), %rax     # 0x1ff90
movq (%rax), %rdi
movl -0x10(%rbp), %esi
addl $0x31, %esi
callq 0x4850
jmp 0xf0ab
movq 0x10f2d(%rip), %rax     # 0x1ff90
movq (%rax), %rdi
movl -0x10(%rbp), %esi
addl $0x31, %esi
movl -0x10(%rbp), %eax
addl $0x1, %eax
shll $0x8, %eax
andl $0xff00, %eax           # imm = 0xFF00
orl $0x200000, %eax         # imm = 0x200000
movl 0x1144a(%rip), %r8d     # 0x204d0
shrl $0xd, %r8d
andl $0x7, %r8d
movl -0x10(%rbp), %r9d
movl $0x40000, %ecx          # imm = 0x40000
movl $0x20000, %edx          # imm = 0x20000
cmpl %r9d, %r8d
cmovnel %edx, %ecx
orl %ecx, %eax
orl %eax, %esi
callq 0x4850
movq 0x10ede(%rip), %rax     # 0x1ff90
movq (%rax), %rdi
movl $0x20, %esi
callq 0x4850
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xf015
movq 0x10ebc(%rip), %rax     # 0x1ff90
movq (%rax), %rdi
movl 0x113f3(%rip), %esi     # 0x204d0
shrl $0xd, %esi
andl $0x7, %esi
addl $0x1, %esi
shll $0x8, %esi
andl $0xff00, %esi           # imm = 0xFF00
orl $0x20000, %esi          # imm = 0x20000
xorl %eax, %eax
movl %eax, %edx
callq 0x4120
movq -0x8(%rbp), %rdi
callq 0x16370
andb $0x1, %al
movb %al, -0x15(%rbp)
testb $0x1, -0x15(%rbp)
je 0xf12c
movq -0x8(%rbp), %rax
movzbl 0x1182b(%rip), %ecx     # 0x20948
subl $0x1, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
jmp 0xf134
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x5cc0
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
addl $0x8, %eax
cmpl -0xc(%rbp), %eax
jg 0xf171
movq 0x10e36(%rip), %rax     # 0x1ff90
movq (%rax), %rdi
movq -0x20(%rbp), %rsi
movl -0xc(%rbp), %edx
subl $0x8, %edx
callq 0x41c0
jmp 0xf27f
movq -0x20(%rbp), %rdi
movslq -0x10(%rbp), %rdx
movl $0x2f, %esi
callq 0xcad0
movq %rax, -0x28(%rbp)
testb $0x1, -0x15(%rbp)
je 0xf1b8
movq 0x10dfc(%rip), %rax     # 0x1ff90
movq (%rax), %rdi
movq -0x20(%rbp), %rax
movsbl (%rax), %esi
callq 0x4850
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movl $0x1, -0x10(%rbp)
jmp 0xf1bf
movl $0x0, -0x10(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xf258
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
je 0xf258
jmp 0xf1da
movq -0x20(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0xf256
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
jne 0xf248
movl -0x10(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x10(%rbp)
movl -0xc(%rbp), %eax
movl -0x10(%rbp), %ecx
addl $0x8, %ecx
cmpl %ecx, %eax
jge 0xf210
movq $0x0, -0x28(%rbp)
jmp 0xf256
movq 0x10d79(%rip), %rax     # 0x1ff90
movq (%rax), %rdi
movq -0x20(%rbp), %rax
movsbl (%rax), %esi
callq 0x4850
movq 0x10d63(%rip), %rax     # 0x1ff90
movq (%rax), %rdi
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movsbl 0x1(%rax), %esi
callq 0x4850
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0xf1da
jmp 0xf258
cmpq $0x0, -0x28(%rbp)
je 0xf27d
movq 0x10d2a(%rip), %rax     # 0x1ff90
movq (%rax), %rdi
movq -0x28(%rbp), %rsi
movl -0xc(%rbp), %edx
movl -0x10(%rbp), %eax
addl $0x8, %eax
subl %eax, %edx
callq 0x41c0
jmp 0xf27f
testb $0x1, -0x15(%rbp)
je 0xf28e
movq -0x8(%rbp), %rdi
callq 0x163f0
movq 0x10cfb(%rip), %rax     # 0x1ff90
movq (%rax), %rdi
movl 0x11232(%rip), %esi     # 0x204d0
shrl $0xd, %esi
andl $0x7, %esi
addl $0x1, %esi
shll $0x8, %esi
andl $0xff00, %esi           # imm = 0xFF00
orl $0x20000, %esi          # imm = 0x20000
xorl %eax, %eax
movl %eax, %edx
callq 0x4740
cmpl $0x0, 0x1b2e2(%rip)     # 0x2a5a8
jle 0xf2f2
movq 0x10cc1(%rip), %rax     # 0x1ff90
movq (%rax), %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x4070
movq 0x10cab(%rip), %rax     # 0x1ff90
movq (%rax), %rdi
movl $0x5e, %esi
callq 0x4850
movl 0x1152c(%rip), %eax     # 0x20824
shrl $0xa, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xf346
movq 0x10c86(%rip), %rax     # 0x1ff90
movq (%rax), %rdi
movl 0x111bd(%rip), %esi     # 0x204d0
shrl $0xd, %esi
andl $0x7, %esi
addl $0x1, %esi
shll $0x8, %esi
andl $0xff00, %esi           # imm = 0xFF00
orl $0x200000, %esi         # imm = 0x200000
xorl %eax, %eax
movl %eax, %edx
callq 0x4120
movl 0x114ea(%rip), %eax     # 0x20824
andl $-0x5, %eax
orl $0x4, %eax
movl %eax, 0x114de(%rip)     # 0x20824
movzwl 0x12b3b(%rip), %eax     # 0x21e88
subl $0x4, %eax
addl 0x1b252(%rip), %eax     # 0x2a5a8
cmpl 0x12b30(%rip), %eax     # 0x21e8c
jge 0xf373
movzwl 0x12b23(%rip), %eax     # 0x21e88
subl $0x4, %eax
addl 0x1b23a(%rip), %eax     # 0x2a5a8
movl %eax, -0x4c(%rbp)
jmp 0xf37c
movl 0x12b13(%rip), %eax     # 0x21e8c
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x132f0
movl %eax, -0x30(%rbp)
movl -0xc(%rbp), %edi
callq 0x17750
movl %eax, -0xc(%rbp)
movl 0x1b207(%rip), %eax     # 0x2a5a8
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0xf40f
movq 0x10bdd(%rip), %rax     # 0x1ff90
movq (%rax), %rdi
movl -0x14(%rbp), %esi
addl $0x1, %esi
movl %esi, -0x14(%rbp)
xorl %edx, %edx
callq 0x4070
cmpl $0x0, -0x30(%rbp)
je 0xf3e7
movslq -0x30(%rbp), %rdi
movq 0x1af99(%rip), %rsi     # 0x2a370
movslq -0x10(%rbp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rsi
callq 0x177b0
movl -0x10(%rbp), %edi
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %eax
cmpl 0x1af82(%rip), %eax     # 0x2a378
sete %al
movzbl %al, %edx
andl $0x1, %edx
callq 0x178a0
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xf3a4
movl 0x1140f(%rip), %eax     # 0x20824
shrl $0x2, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xf463
movq 0x10b69(%rip), %rax     # 0x1ff90
movq (%rax), %rdi
movl 0x110a0(%rip), %esi     # 0x204d0
shrl $0xd, %esi
andl $0x7, %esi
addl $0x1, %esi
shll $0x8, %esi
andl $0xff00, %esi           # imm = 0xFF00
orl $0x200000, %esi         # imm = 0x200000
xorl %eax, %eax
movl %eax, %edx
callq 0x4740
movl 0x113cd(%rip), %eax     # 0x20824
andl $-0x5, %eax
orl $0x0, %eax
movl %eax, 0x113c1(%rip)     # 0x20824
movl -0x2c(%rbp), %eax
cmpl 0x12a20(%rip), %eax     # 0x21e8c
jge 0xf49d
movq 0x10b1b(%rip), %rax     # 0x1ff90
movq (%rax), %rdi
movzwl 0x12a09(%rip), %esi     # 0x21e88
subl $0x2, %esi
xorl %edx, %edx
callq 0x4070
movq 0x10b00(%rip), %rax     # 0x1ff90
movq (%rax), %rdi
movl $0x76, %esi
callq 0x4850
callq 0x17c30
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)