// File: /workspace/github_c_makefile_star2_O2/anachronic[P]st/st.c
// Function: tresizealt
void
tresizealt(int col, int row)
{
	int i, j;

	/* return if dimensions haven't changed */
	if (term.col == col && term.row == row) {
		tfulldirt();
		return;
	}
	if (sel.alt)
		selremove();
	/* slide screen up if otherwise cursor would get out of the screen */
	for (i = 0; i <= term.c.y - row; i++)
		free(term.line[i]);
	if (i > 0) {
		/* ensure that both src and dst are not NULL */
		memmove(term.line, term.line + i, row * sizeof(Line));
		term.c.y = row - 1;
	}
	for (i += row; i < term.row; i++)
		free(term.line[i]);
	/* resize to new height */
	term.line = xrealloc(term.line, row * sizeof(Line));
	/* resize to new width */
	for (i = 0; i < MIN(row, term.row); i++) {
		term.line[i] = xrealloc(term.line[i], col * sizeof(Glyph));
		for (j = term.col; j < col; j++)
			tclearglyph(&term.line[i][j], 0);
	}
	/* allocate any new rows */
	for (/*i = MIN(row, term.row) */; i < row; i++) {
		term.line[i] = xmalloc(col * sizeof(Glyph));
		for (j = 0; j < col; j++)
			tclearglyph(&term.line[i][j], 0);
	}
	/* update cursor */
	if (term.c.x >= col) {
		term.c.state &= ~CURSOR_WRAPNEXT;
		term.c.x = col - 1;
	} else {
		UPDATEWRAPNEXT(1, col);
	}
	/* update terminal size */
	term.col = col, term.row = row;
	/* reset scrolling region */
	term.top = 0, term.bot = row - 1;
	/* dirty all lines */
	tfulldirt();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edi, %r12d
cmpl %edi, 0x114a5(%rip)     # 0x188f4
jne 0x745d
cmpl %esi, 0x11499(%rip)     # 0x188f0
je 0x768a
movq %rsi, (%rsp)
movl %esi, %r14d
cmpl $0x0, 0x11481(%rip)     # 0x188ec
je 0x747b
andl $0x0, 0x1144c(%rip)     # 0x188c0
orl $-0x1, 0x11461(%rip)    # 0x188dc
xorl %ebx, %ebx
movslq (%rsp), %r15
movslq 0x1532c(%rip), %rax     # 0x1c7b4
subq %r15, %rax
cmpq %rax, %rbx
jg 0x74a5
movq 0x11461(%rip), %rax     # 0x188f8
movq (%rax,%rbx,8), %rdi
callq 0x5340
incq %rbx
jmp 0x7481
movq %r14, 0x8(%rsp)
addq %rbx, %r14
testq %rbx, %rbx
je 0x74d8
movq 0x1143f(%rip), %rdi     # 0x188f8
movl %ebx, %eax
leaq (%rdi,%rax,8), %rsi
leaq (,%r15,8), %rdx
callq 0x5510
movq (%rsp), %rax
decl %eax
movl %eax, 0x152dc(%rip)     # 0x1c7b4
movslq %r14d, %rbx
movslq 0x1140e(%rip), %rax     # 0x188f0
movq 0x1140f(%rip), %rdi     # 0x188f8
cmpq %rax, %rbx
jge 0x74fc
movq (%rdi,%rbx,8), %rdi
callq 0x5340
incq %rbx
jmp 0x74db
shlq $0x3, %r15
movq %r15, %rsi
callq 0x5ade
movq %rax, 0x113e9(%rip)     # 0x188f8
movq %r12, 0x10(%rsp)
movslq %r12d, %r15
movq %r15, %r14
shlq $0x4, %r14
xorl %r13d, %r13d
leaq 0x10fb8(%rip), %rbp     # 0x184e0
leaq 0x10fad(%rip), %r12     # 0x184dc
movq (%rsp), %rbx
movl 0x113b7(%rip), %ecx     # 0x188f0
cmpl %ebx, %ecx
cmovgel %ebx, %ecx
movslq %ecx, %rcx
cmpq %rcx, %r13
jge 0x75aa
movq (%rax,%r13,8), %rdi
movq %r14, %rsi
callq 0x5ade
movq 0x1139f(%rip), %rcx     # 0x188f8
movq %rax, (%rcx,%r13,8)
movslq 0x11390(%rip), %rcx     # 0x188f4
movq 0x1138d(%rip), %rax     # 0x188f8
movq %rcx, %rdx
shlq $0x4, %rdx
orq $0xc, %rdx
cmpq %r15, %rcx
jge 0x75a5
movq (%rax,%r13,8), %rsi
movl (%rbp), %edi
movl (%r12), %r8d
movl %r8d, -0x4(%rsi,%rdx)
movl %edi, (%rsi,%rdx)
andw $0x0, -0x8(%rsi,%rdx)
movl $0x20, -0xc(%rsi,%rdx)
incq %rcx
addq $0x10, %rdx
jmp 0x7576
incq %r13
jmp 0x7533
xorl %r15d, %r15d
movq 0x10(%rsp), %rax
testl %eax, %eax
cmovgl %eax, %r15d
cmpl %r13d, %ebx
movq %rbx, %rax
movl %r13d, %ebx
cmovgl %eax, %ebx
shlq $0x4, %r15
cmpq %rbx, %r13
je 0x7619
movq %r14, %rdi
callq 0x5a1c
movq 0x1131c(%rip), %rcx     # 0x188f8
movq %rax, (%rcx,%r13,8)
movq 0x11311(%rip), %rax     # 0x188f8
xorl %ecx, %ecx
cmpq %rcx, %r15
je 0x7614
movq (%rax,%r13,8), %rdx
movl (%rbp), %esi
movl (%r12), %edi
movl %edi, 0x8(%rdx,%rcx)
movl %esi, 0xc(%rdx,%rcx)
andw $0x0, 0x4(%rdx,%rcx)
movl $0x20, (%rdx,%rcx)
addq $0x10, %rcx
jmp 0x75e9
incq %r13
jmp 0x75c8
movl 0x15191(%rip), %ecx     # 0x1c7b0
movb 0x15193(%rip), %al      # 0x1c7b8
movq 0x10(%rsp), %rsi
cmpl %esi, %ecx
jge 0x7655
testb $0x1, %al
movq (%rsp), %rdx
movq 0x8(%rsp), %rdi
je 0x766f
addl 0x1514f(%rip), %ecx     # 0x1c790
cmpl %esi, %ecx
jge 0x766f
movl %ecx, 0x15165(%rip)     # 0x1c7b0
andb $-0x2, %al
movb %al, 0x15165(%rip)      # 0x1c7b8
jmp 0x766f
andb $-0x2, %al
movb %al, 0x1515b(%rip)      # 0x1c7b8
leal -0x1(%rsi), %eax
movl %eax, 0x1514a(%rip)     # 0x1c7b0
movq (%rsp), %rdx
movq 0x8(%rsp), %rdi
movl %esi, 0x1127f(%rip)     # 0x188f4
movl %edi, 0x11275(%rip)     # 0x188f0
andl $0x0, 0x15142(%rip)     # 0x1c7c4
decl %edx
movl %edx, 0x1513e(%rip)     # 0x1c7c8
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x700e