// File: /workspace/github_c_makefile_star2_O3/uobikiemukot[P]yaft/./ctrlseq/csi.h
// Function: erase_display
void erase_display(struct terminal_t *term, struct parm_t *parm)
{
	int i, j, mode;

	mode = (parm->argc <= 0) ? 0: dec2num(parm->argv[parm->argc - 1]);

	if (mode < 0 || 2 < mode)
		return;

	if (mode == 0) {
		for (i = term->cursor.y; i < term->lines; i++)
			for (j = 0; j < term->cols; j++)
				if (i > term->cursor.y || (i == term->cursor.y && j >= term->cursor.x))
					erase_cell(term, i, j);
	} else if (mode == 1) {
		for (i = 0; i <= term->cursor.y; i++)
			for (j = 0; j < term->cols; j++)
				if (i < term->cursor.y || (i == term->cursor.y && j <= term->cursor.x))
					erase_cell(term, i, j);
	} else if (mode == 2) {
		for (i = 0; i < term->lines; i++)
			for (j = 0; j < term->cols; j++)
				erase_cell(term, i, j);
	}
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl (%rsi), %eax
testl %eax, %eax
jle 0x4b37
decl %eax
movq 0x8(%rsi,%rax,8), %rdi
testq %rdi, %rdi
je 0x4b37
xorl %esi, %esi
movl $0xa, %edx
callq 0x2d12
cmpl $0x2, %eax
ja 0x4bc9
testl %eax, %eax
je 0x4b37
cmpl $0x1, %eax
jne 0x4bcb
movl 0xc(%rbx), %edx
xorl %ecx, %ecx
movabsq $0x100000000, %rax      # imm = 0x100000000
testl %edx, %edx
jle 0x4b22
movl $0x14, %esi
xorl %edi, %edi
movzwl 0x26(%rbx), %r8d
cmpq %r8, %rcx
jae 0x4b04
movq 0x18(%rbx), %rdx
movq (%rdx,%rcx,8), %rdx
movq 0x588(%rbx), %r8
movq %r8, -0x14(%rdx,%rsi)
movzwl 0x4c(%rbx), %r8d
movw %r8w, -0xc(%rdx,%rsi)
movq %rax, -0x8(%rdx,%rsi)
movb $0x0, (%rdx,%rsi)
movq 0x28(%rbx), %rdx
movb $0x1, (%rdx,%rcx)
movl 0xc(%rbx), %edx
jmp 0x4b10
jne 0x4b10
movzwl 0x24(%rbx), %r8d
cmpq %r8, %rdi
jbe 0x4acf
incq %rdi
movslq %edx, %r8
addq $0x218, %rsi            # imm = 0x218
cmpq %r8, %rdi
jl 0x4ac5
leaq 0x1(%rcx), %rsi
movzwl 0x26(%rbx), %edi
cmpq %rdi, %rcx
movq %rsi, %rcx
jb 0x4aba
jmp 0x4bc9
movzwl 0x26(%rbx), %eax
movl 0x10(%rbx), %esi
cmpl %eax, %esi
jle 0x4bc9
movl 0xc(%rbx), %edx
movabsq $0x100000000, %rcx      # imm = 0x100000000
testl %edx, %edx
jle 0x4bbe
movl $0x14, %esi
xorl %edi, %edi
movzwl 0x26(%rbx), %r8d
cmpq %r8, %rax
jbe 0x4b9d
movq 0x18(%rbx), %rdx
movq (%rdx,%rax,8), %rdx
movq 0x588(%rbx), %r8
movq %r8, -0x14(%rdx,%rsi)
movzwl 0x4c(%rbx), %r8d
movw %r8w, -0xc(%rdx,%rsi)
movq %rcx, -0x8(%rdx,%rsi)
movb $0x0, (%rdx,%rsi)
movq 0x28(%rbx), %rdx
movb $0x1, (%rdx,%rax)
movl 0xc(%rbx), %edx
jmp 0x4ba9
jne 0x4ba9
movzwl 0x24(%rbx), %r8d
cmpq %r8, %rdi
jae 0x4b68
incq %rdi
movslq %edx, %r8
addq $0x218, %rsi            # imm = 0x218
cmpq %r8, %rdi
jl 0x4b5e
movl 0x10(%rbx), %esi
incq %rax
movslq %esi, %rdi
cmpq %rdi, %rax
jl 0x4b53
popq %rbx
retq
movl 0x10(%rbx), %esi
testl %esi, %esi
jle 0x4bc9
movl 0xc(%rbx), %edx
xorl %eax, %eax
movabsq $0x100000000, %rcx      # imm = 0x100000000
testl %edx, %edx
jle 0x4c32
movl $0x14, %esi
xorl %edi, %edi
movq 0x18(%rbx), %rdx
movq (%rdx,%rax,8), %rdx
movq 0x588(%rbx), %r8
movq %r8, -0x14(%rdx,%rsi)
movzwl 0x4c(%rbx), %r8d
movw %r8w, -0xc(%rdx,%rsi)
movq %rcx, -0x8(%rdx,%rsi)
movb $0x0, (%rdx,%rsi)
movq 0x28(%rbx), %rdx
movb $0x1, (%rdx,%rax)
incq %rdi
movslq 0xc(%rbx), %rdx
addq $0x218, %rsi            # imm = 0x218
cmpq %rdx, %rdi
jl 0x4bec
movl 0x10(%rbx), %esi
incq %rax
movslq %esi, %rdi
cmpq %rdi, %rax
jl 0x4be1
jmp 0x4bc9