#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ asm_cprint(char, char, char, char);
int /*<<< orphan*/ gotoxy(char, char, char);
void clearwindow(char top, char left, char bot, char right, char page,
                 char fillchar, char fillattr) {
  char x;
  for (x = top; x < bot + 1; x++) {
    gotoxy(x, left, page);
    asm_cprint(fillchar, fillattr, right - left + 1, page);
  }
}


x86 assembly (clang, -O0):
<clearwindow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %r8d,-0x18(%rbp)
mov    %ecx,%eax
mov    -0x18(%rbp),%ecx
mov    %eax,-0x14(%rbp)
mov    %edx,%eax
mov    -0x14(%rbp),%edx
mov    %eax,-0x10(%rbp)
mov    %esi,%eax
mov    -0x10(%rbp),%esi
mov    %eax,-0xc(%rbp)
mov    %edi,%r8d
mov    -0xc(%rbp),%edi
mov    %r9b,%al
mov    0x10(%rbp),%r9b
mov    %r8b,-0x1(%rbp)
mov    %dil,-0x2(%rbp)
mov    %sil,-0x3(%rbp)
mov    %dl,-0x4(%rbp)
mov    %cl,-0x5(%rbp)
mov    %al,-0x6(%rbp)
mov    -0x1(%rbp),%al
mov    %al,-0x7(%rbp)
movsbl -0x7(%rbp),%eax
movsbl -0x3(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    11c6 <clearwindow+0xa6>
mov    -0x7(%rbp),%cl
mov    -0x2(%rbp),%al
movsbl %cl,%edi
movsbl %al,%esi
movsbl -0x5(%rbp),%edx
call   1030 <gotoxy@plt>
mov    -0x6(%rbp),%dl
mov    0x10(%rbp),%cl
movsbl -0x4(%rbp),%eax
movsbl -0x2(%rbp),%esi
sub    %esi,%eax
add    $0x1,%eax
movsbl %dl,%edi
movsbl %cl,%esi
movsbl %al,%edx
movsbl -0x5(%rbp),%ecx
call   1040 <asm_cprint@plt>
mov    -0x7(%rbp),%al
add    $0x1,%al
mov    %al,-0x7(%rbp)
jmp    116c <clearwindow+0x4c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clearwindow>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %edi,%ebp
cmp    %r15b,%bpl
jg     118a <clearwindow+0x6a>
sub    %sil,%cl
add    $0x1,%cl
movsbl %sil,%eax
mov    %eax,0x4(%rsp)
movsbl %r8b,%ebx
movsbl %r9b,%r12d
movsbl 0x40(%rsp),%r13d
movsbl %cl,%r14d
cs nopw 0x0(%rax,%rax,1)
nop
movsbl %bpl,%ebp
mov    %ebp,%edi
mov    0x4(%rsp),%esi
mov    %ebx,%edx
call   1030 <gotoxy@plt>
mov    %r12d,%edi
mov    %r13d,%esi
mov    %r14d,%edx
mov    %ebx,%ecx
call   1040 <asm_cprint@plt>
add    $0x1,%bpl
cmp    %r15b,%bpl
jle    1160 <clearwindow+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @clearwindow(i8 signext %0, i8 signext %1, i8 signext %2, i8 signext %3, i8 signext %4, i8 signext %5, i8 signext %6) {
%8 = alloca i8
%9 = alloca i8
%10 = alloca i8
%11 = alloca i8
%12 = alloca i8
%13 = alloca i8
%14 = alloca i8
%15 = alloca i8
store i8 %0, i8* %8
store i8 %1, i8* %9
store i8 %2, i8* %10
store i8 %3, i8* %11
store i8 %4, i8* %12
store i8 %5, i8* %13
store i8 %6, i8* %14
%16 = load i8, i8* %8
store i8 %16, i8* %15
br label %17
17: ; preds = %40, %7
%18 = load i8, i8* %15
%19 = sext i8 %18 to i32
%20 = load i8, i8* %10
%21 = sext i8 %20 to i32
%22 = add nsw i32 %21, 1
%23 = icmp slt i32 %19, %22
br i1 %23, label %24, label %43
24: ; preds = %17
%25 = load i8, i8* %15
%26 = load i8, i8* %9
%27 = load i8, i8* %12
%28 = call i32 @gotoxy(i8 signext %25, i8 signext %26, i8 signext %27)
%29 = load i8, i8* %13
%30 = load i8, i8* %14
%31 = load i8, i8* %11
%32 = sext i8 %31 to i32
%33 = load i8, i8* %9
%34 = sext i8 %33 to i32
%35 = sub nsw i32 %32, %34
%36 = add nsw i32 %35, 1
%37 = trunc i32 %36 to i8
%38 = load i8, i8* %12
%39 = call i32 @asm_cprint(i8 signext %29, i8 signext %30, i8 signext %37, i8 signext %38)
br label %40
40: ; preds = %24
%41 = load i8, i8* %15
%42 = add i8 %41, 1
store i8 %42, i8* %15
br label %17
43: ; preds = %17
ret void
}

LLVM IR (-O2):
define void @clearwindow(i8 signext %0, i8 signext %1, i8 signext %2, i8 signext %3, i8 signext %4, i8 signext %5, i8 signext %6) {
%8 = icmp sgt i8 %0, %2
br i1 %8, label %18, label %9
9: ; preds = %7
%10 = sub i8 1, %1
%11 = add i8 %10, %3
br label %12
12: ; preds = %9, %12
%13 = phi i8 [ %0, %9 ], [ %16, %12 ]
%14 = tail call i32 @gotoxy(i8 signext %13, i8 signext %1, i8 signext %4)
%15 = tail call i32 @asm_cprint(i8 signext %5, i8 signext %6, i8 signext %11, i8 signext %4)
%16 = add i8 %13, 1
%17 = icmp sgt i8 %16, %2
br i1 %17, label %18, label %12
18: ; preds = %12, %7
ret void
}