// File: /workspace/github_c_makefile_star2_O2/baines[P]MiniGBS/ui.c
// Function: ui_init
int ui_init(void){
	if(cfg.hide_ui)
		return -1;

	initscr();
	noecho();
	cbreak();
	timeout(0);
	curs_set(0);
	nodelay(stdscr, TRUE);
	keypad(stdscr, TRUE);
	set_escdelay(0);

	if(!cfg.monochrome){
		start_color();

		if(can_change_color() && COLORS > 100){
			init_color(COLOR_BLACK, 91, 91, 102);
		}

		init_pair(1, COLOR_CYAN   , COLOR_BLACK);
		init_pair(2, COLOR_MAGENTA, COLOR_BLACK);
		init_pair(3, COLOR_RED    , COLOR_BLACK);
		init_pair(4, COLOR_YELLOW , COLOR_BLACK);
		init_pair(5, COLOR_BLACK  , COLOR_BLACK);
		init_pair(6, COLOR_GREEN  , COLOR_BLACK);
		init_pair(7, COLOR_WHITE  , COLOR_BLACK);

		init_pair(8 , COLOR_CYAN    , COLOR_MAGENTA);
		init_pair(9 , COLOR_CYAN    , COLOR_RED);
		init_pair(10, COLOR_MAGENTA , COLOR_RED);

		init_pair(11, COLOR_BLACK, COLOR_CYAN);
		init_pair(12, COLOR_BLACK, COLOR_MAGENTA);
		init_pair(13, COLOR_BLACK, COLOR_RED);
		init_pair(14, COLOR_BLACK, COLOR_YELLOW);

		bkgd(COLOR_PAIR(7));
	}

	getmaxyx(stdscr, cfg.win_h, cfg.win_w);

	return x11_init();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x89bb(%rip), %r13      # 0x12448
cmpb $0x0, 0x5(%r13)
je 0x9aa6
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x5320
callq 0x5170
callq 0x54d0
movq 0x8514(%rip), %rbp      # 0x11fd0
movq (%rbp), %rdi
xorl %esi, %esi
callq 0x50c0
xorl %edi, %edi
callq 0x51e0
movq (%rbp), %rdi
pushq $0x1
popq %rbx
movl %ebx, %esi
callq 0x5040
movq (%rbp), %rdi
movl %ebx, %esi
callq 0x5180
xorl %edi, %edi
callq 0x53a0
cmpb $0x0, 0x4(%r13)
jne 0x9bf3
callq 0x5490
callq 0x53d0
testb %al, %al
je 0x9b22
movq 0x84d2(%rip), %rax      # 0x11fe0
cmpl $0x65, (%rax)
jl 0x9b22
pushq $0x5b
popq %rdx
pushq $0x66
popq %rcx
xorl %edi, %edi
movl %edx, %esi
callq 0x5110
pushq $0x1
popq %r12
pushq $0x6
popq %r14
movl %r12d, %edi
movl %r14d, %esi
xorl %edx, %edx
callq 0x50a0
pushq $0x2
popq %rdi
pushq $0x5
popq %r15
movl %r15d, %esi
xorl %edx, %edx
callq 0x50a0
pushq $0x3
popq %rbx
movl %ebx, %edi
movl %r12d, %esi
xorl %edx, %edx
callq 0x50a0
pushq $0x4
popq %rdi
movl %ebx, %esi
xorl %edx, %edx
callq 0x50a0
movl %r15d, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x50a0
movl %r14d, %edi
pushq $0x2
popq %rsi
xorl %edx, %edx
callq 0x50a0
pushq $0x7
popq %rdi
movl %edi, %esi
xorl %edx, %edx
callq 0x50a0
pushq $0x8
popq %rdi
movl %r14d, %esi
movl %r15d, %edx
callq 0x50a0
pushq $0x9
popq %rdi
movl %r14d, %esi
movl %r12d, %edx
callq 0x50a0
pushq $0xa
popq %rdi
movl %r15d, %esi
movl %r12d, %edx
callq 0x50a0
pushq $0xb
popq %rdi
xorl %esi, %esi
movl %r14d, %edx
callq 0x50a0
pushq $0xc
popq %rdi
xorl %esi, %esi
movl %r15d, %edx
callq 0x50a0
pushq $0xd
popq %rdi
xorl %esi, %esi
movl %r12d, %edx
callq 0x50a0
pushq $0xe
popq %rdi
xorl %esi, %esi
movl %ebx, %edx
callq 0x50a0
movq (%rbp), %rdi
movl $0x700, %esi            # imm = 0x700
callq 0x5140
movq (%rbp), %rcx
testq %rcx, %rcx
je 0x9c0a
movswl 0x4(%rcx), %eax
incl %eax
movswl 0x6(%rcx), %ecx
incl %ecx
jmp 0x9c0f
pushq $-0x1
popq %rax
movl %eax, %ecx
movl %eax, 0x2c(%r13)
movl %ecx, 0x28(%r13)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xaba8