// File: /workspace/github_c_makefile_star2_O0/jarun[P]nnn/src/nnn.c
// Function: initcurses
static bool initcurses(void *oldmask)
{
#ifdef NOMOUSE
	(void) oldmask;
#endif

	if (g_state.picker) {
		if (!newterm(NULL, stderr, stdin)) {
			msg("newterm!");
			return FALSE;
		}
	} else if (!initscr()) {
		msg("initscr!");
		DPRINTF_S(getenv("TERM"));
		return FALSE;
	}

	cbreak();
	noecho();
	nonl();
	//intrflush(stdscr, FALSE);
	keypad(stdscr, TRUE);
#ifndef NOMOUSE
#if NCURSES_MOUSE_VERSION <= 1
	mousemask(BUTTON1_PRESSED | BUTTON1_DOUBLE_CLICKED | BUTTON2_PRESSED | BUTTON3_PRESSED,
		  (mmask_t *)oldmask);
#else
	mousemask(BUTTON1_PRESSED | BUTTON2_PRESSED | BUTTON3_PRESSED | BUTTON4_PRESSED
		  | BUTTON5_PRESSED, (mmask_t *)oldmask);
#endif
	mouseinterval(0);
#endif
	curs_set(FALSE); /* Hide cursor */

	char *colors = getenv(env_cfg[NNN_COLORS]);

	if (colors || !getenv("NO_COLOR")) {
		uint_t *pcode;
		bool ext = FALSE;

		start_color();
		use_default_colors();

		/* Initialize file colors */
		if (COLORS >= COLOR_256) {
			if (!(g_state.oldcolor || init_fcolors())) {
				exitcurses();
				msg(env_cfg[NNN_FCOLORS]);
				return FALSE;
			}
		} else
			g_state.oldcolor = 1;

		DPRINTF_D(COLORS);
		DPRINTF_D(COLOR_PAIRS);

		if (colors && *colors == '#') {
			char *sep = strchr(colors, ';');

			if (!g_state.oldcolor && COLORS >= COLOR_256) {
				++colors;
				ext = TRUE;

				/*
				 * If fallback colors are specified, set the separator
				 * to NULL so we don't interpret separator and fallback
				 * if fewer than CTX_MAX xterm 256 colors are specified.
				 */
				if (sep)
					*sep = '\0';
			} else {
				colors = sep; /* Detect if 8 colors fallback is appended */
				if (colors)
					++colors;
			}
		}

		/* Get and set the context colors */
		for (uchar_t i = 0; i < CTX_MAX; ++i) {
			pcode = &g_ctx[i].color;

			if (colors && *colors) {
				if (ext) {
					*pcode = xchartohex(*colors) << 4;
					if (*++colors)
						fcolors[i + 1] = *pcode += xchartohex(*colors);
					else { /* Each color code must be 2 hex symbols */
						exitcurses();
						msg(env_cfg[NNN_COLORS]);
						return FALSE;
					}
				} else {
					*pcode = (*colors < '0' || *colors > '7') ? 4 : *colors - '0';
					fcolors[i + 1] = *pcode;
				}
				++colors;
			} else
				*pcode = 4;

			init_pair(i + 1, *pcode, -1);
		}
	}
#ifdef ICONS_ENABLED
	if (!g_state.oldcolor) {
		for (uint_t i = 0; i < ELEMENTS(init_colors); ++i)
			init_pair(C_UND + 1 + init_colors[i], init_colors[i], -1);
	}
#endif

	settimeout(); /* One second */
	set_escdelay(25);
	return TRUE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl 0x19222(%rip), %eax     # 0x20824
shrl $0xc, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x7647
movq 0x189e4(%rip), %rax     # 0x1fff8
movq (%rax), %rsi
movq 0x1895a(%rip), %rax     # 0x1ff78
movq (%rax), %rdx
xorl %eax, %eax
movl %eax, %edi
callq 0x4230
cmpq $0x0, %rax
jne 0x7645
leaq 0x14ff3(%rip), %rdi     # 0x1c62a
callq 0x6ab0
movb $0x0, -0x1(%rbp)
jmp 0x7946
jmp 0x7669
callq 0x4660
cmpq $0x0, %rax
jne 0x7667
leaq 0x14fda(%rip), %rdi     # 0x1c633
callq 0x6ab0
movb $0x0, -0x1(%rbp)
jmp 0x7946
jmp 0x7669
callq 0x45c0
callq 0x4060
callq 0x47e0
movq 0x18911(%rip), %rax     # 0x1ff90
movq (%rax), %rdi
movl $0x1, %esi
callq 0x4410
movq -0x10(%rbp), %rsi
movl $0x210842, %edi         # imm = 0x210842
callq 0x4780
xorl %edi, %edi
callq 0x44b0
xorl %edi, %edi
callq 0x4140
movq 0x182b1(%rip), %rdi     # 0x1f960
callq 0x4050
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x76d5
leaq 0x14f76(%rip), %rdi     # 0x1c63c
callq 0x4050
cmpq $0x0, %rax
jne 0x7924
movb $0x0, -0x21(%rbp)
callq 0x4030
callq 0x4040
movq 0x188ce(%rip), %rax     # 0x1ffb8
cmpl $0x100, (%rax)          # imm = 0x100
jl 0x7728
movl 0x1912c(%rip), %eax     # 0x20824
shrl $0xa, %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x7726
callq 0xd2a0
testb $0x1, %al
jne 0x7726
callq 0x4890
movq 0x18250(%rip), %rdi     # 0x1f968
callq 0x6ab0
movb $0x0, -0x1(%rbp)
jmp 0x7946
jmp 0x773e
movl 0x190f6(%rip), %eax     # 0x20824
andl $0xfffffbff, %eax       # imm = 0xFFFFFBFF
orl $0x400, %eax            # imm = 0x400
movl %eax, 0x190e6(%rip)     # 0x20824
cmpq $0x0, -0x18(%rbp)
je 0x77c2
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
jne 0x77c2
movq -0x18(%rbp), %rdi
movl $0x3b, %esi
callq 0x4310
movq %rax, -0x30(%rbp)
movl 0x190bb(%rip), %eax     # 0x20824
shrl $0xa, %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x77a3
movq 0x1883d(%rip), %rax     # 0x1ffb8
cmpl $0x100, (%rax)          # imm = 0x100
jl 0x77a3
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movb $0x1, -0x21(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x77a1
movq -0x30(%rbp), %rax
movb $0x0, (%rax)
jmp 0x77c0
movq -0x30(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x77be
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x77c0
jmp 0x77c2
movb $0x0, -0x31(%rbp)
movzbl -0x31(%rbp), %eax
cmpl $0x4, %eax
jge 0x7922
movzbl -0x31(%rbp), %eax
movl %eax, %ecx
leaq 0x1a6b0(%rip), %rax     # 0x21e90
imulq $0x2138, %rcx, %rcx     # imm = 0x2138
addq %rcx, %rax
addq $0x2134, %rax           # imm = 0x2134
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x78eb
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x78eb
testb $0x1, -0x21(%rbp)
je 0x788b
movq -0x18(%rbp), %rax
movzbl (%rax), %edi
callq 0xd3d0
movzbl %al, %ecx
shll $0x4, %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rbp)
cmpb $0x0, 0x1(%rax)
je 0x786f
movq -0x18(%rbp), %rax
movzbl (%rax), %edi
callq 0xd3d0
movzbl %al, %edx
movq -0x20(%rbp), %rax
addl (%rax), %edx
movl %edx, (%rax)
movzbl -0x31(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq 0x22b16(%rip), %rax     # 0x2a380
movl %edx, (%rax,%rcx,4)
jmp 0x7889
callq 0x4890
movq 0x180e5(%rip), %rdi     # 0x1f960
callq 0x6ab0
movb $0x0, -0x1(%rbp)
jmp 0x7946
jmp 0x78dd
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
jl 0x78a3
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x37, %eax
jle 0x78ad
movl $0x4, %eax
movl %eax, -0x38(%rbp)
jmp 0x78ba
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
subl $0x30, %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
movl (%rax), %edx
movzbl -0x31(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq 0x22aa6(%rip), %rax     # 0x2a380
movl %edx, (%rax,%rcx,4)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x78f5
movq -0x20(%rbp), %rax
movl $0x4, (%rax)
movzbl -0x31(%rbp), %eax
addl $0x1, %eax
movw %ax, %cx
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movswl %cx, %edi
movswl %ax, %esi
callq 0x4620
movb -0x31(%rbp), %al
addb $0x1, %al
movb %al, -0x31(%rbp)
jmp 0x77c6
jmp 0x7924
movq 0x18665(%rip), %rax     # 0x1ff90
movq (%rax), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x4580
movl $0x19, %edi
callq 0x4390
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)