// File: /workspace/github_c_makefile_star2_O1/martintopholm[P]xping/termio.c
// Function: termio_init
void
termio_init(void)
{
#ifndef NCURSES
	struct termios term;
	struct target *t;
	int x, y;

	signal(SIGWINCH, sigwinch);
	x = getmaxx();
	y = getmaxy();
	if (x > 0 && y > 0) {
	scrbuffer = malloc(x * y);
	if (scrbuffer != NULL)
		setvbuf(stdout, scrbuffer, _IOFBF, x * y);
	else
		perror("malloc");
	} else {
		scrbuffer = NULL;
	}

	/* Reserve space on terminal */
	cursor_y = 0;
	DL_FOREACH(list, t) {
		cursor_y++;
		scrolldown(1);
	}
	scrollup(cursor_y);

	/* Establish reference point for move() */
	fprintf(stdout, "\r%c[s", 0x1b);
	cursor_y = 0;

	/* Avoid mangling output by disabling input echo and wrapping */
	fprintf(stdout, "%c[7l", 0x1b);
	if (isatty(STDOUT_FILENO) && tcgetattr(STDOUT_FILENO, &oterm) == 0) {
		memcpy(&term, &oterm, sizeof(term));
		term.c_lflag &= ~(ECHO | ECHONL);
		tcsetattr(STDOUT_FILENO, TCSAFLUSH, &term);
	}
#else /* NCURSES */
	initscr();
#endif /* !NCURSES */
	labelwidth = (w_width > 0 ? w_width + 1 : 0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x48, %rsp
leaq -0x318(%rip), %rsi      # 0x3983
movl $0x1c, %edi
callq 0x2240
callq 0x3854
movl %eax, %ebp
callq 0x38b8
movl %eax, %ebx
testl %ebp, %ebp
setg %al
testl %ebx, %ebx
setg %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x3cf8
imull %ebp, %ebx
movq %rbx, %rdi
callq 0x22c0
movq %rax, 0x362a(%rip)      # 0x7300
testq %rax, %rax
je 0x3e41
movq 0x32ca(%rip), %rcx      # 0x6fb0
movq (%rcx), %rdi
movq %rax, %rsi
xorl %edx, %edx
movq %rbx, %rcx
callq 0x2030
jmp 0x3d03
movq $0x0, 0x35fd(%rip) # 0x7300
movl $0x0, 0x35eb(%rip)      # 0x72f8
leaq 0x355c(%rip), %rax      # 0x7270
movq (%rax), %r14
testq %r14, %r14
je 0x3d4e
movq 0x328d(%rip), %r15      # 0x6fb0
leaq 0x167e(%rip), %rbx      # 0x53a8
incl 0x35c8(%rip)            # 0x72f8
movq (%r15), %rdi
movq %rbx, %rsi
movl $0x1b, %edx
xorl %eax, %eax
callq 0x2310
movq 0x198(%r14), %r14
testq %r14, %r14
jne 0x3d2a
movl 0x35a4(%rip), %ebp      # 0x72f8
testl %ebp, %ebp
jle 0x3d7c
movq 0x3251(%rip), %r14      # 0x6fb0
leaq 0x1646(%rip), %rbx      # 0x53ac
movq (%r14), %rdi
movq %rbx, %rsi
movl $0x1b, %edx
xorl %eax, %eax
callq 0x2310
decl %ebp
jne 0x3d66
movq 0x322d(%rip), %r14      # 0x6fb0
movq (%r14), %rdi
leaq 0x1603(%rip), %rsi      # 0x5390
xorl %ebx, %ebx
movl $0x1b, %edx
xorl %eax, %eax
callq 0x2310
movl $0x0, 0x3553(%rip)      # 0x72f8
movq (%r14), %rdi
leaq 0x15ee(%rip), %rsi      # 0x539d
movl $0x1b, %edx
xorl %eax, %eax
callq 0x2310
movl $0x1, %edi
callq 0x23b0
testl %eax, %eax
je 0x3e1f
leaq 0x3538(%rip), %rsi      # 0x7308
movl $0x1, %edi
callq 0x2200
testl %eax, %eax
jne 0x3e1f
movups 0x3523(%rip), %xmm0     # 0x7308
movq %rsp, %rdx
movaps %xmm0, (%rdx)
movups 0x3542(%rip), %xmm0     # 0x7334
movups %xmm0, 0x2c(%rdx)
movups 0x352b(%rip), %xmm0     # 0x7328
movaps %xmm0, 0x20(%rdx)
movups 0x3510(%rip), %xmm0     # 0x7318
movaps %xmm0, 0x10(%rdx)
andb $-0x49, 0xc(%rdx)
movl $0x1, %edi
movl $0x2, %esi
callq 0x22b0
leaq 0x33f6(%rip), %rax      # 0x721c
movl (%rax), %eax
leal 0x1(%rax), %ecx
testl %eax, %eax
cmovgl %ecx, %ebx
movl %ebx, 0x350e(%rip)      # 0x7344
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x129f(%rip), %rdi      # 0x50e7
callq 0x2170
jmp 0x3d03