#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*/ get_screen_offset(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ print_char(char, int, int, unsigned char);
int /*<<< orphan*/ set_cursor(int /*<<< orphan*/);
void clear_screen_clr(unsigned char color) {
  int row;
  int col;
  for (row = 0; row < 25; row++) {
    for (col = 0; col < 80; col++) {
      print_char(' ', col, row, color);
    }
  }
  set_cursor(get_screen_offset(0, 0));
}


x86 assembly (clang, -O0):
<clear_screen_clr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x19,-0x8(%rbp)
jge    1195 <clear_screen_clr+0x65>
movl   $0x0,-0xc(%rbp)
cmpl   $0x50,-0xc(%rbp)
jge    1182 <clear_screen_clr+0x52>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    $0x20,%edi
movzbl -0x1(%rbp),%ecx
call   1050 <print_char@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1156 <clear_screen_clr+0x26>
jmp    1187 <clear_screen_clr+0x57>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1145 <clear_screen_clr+0x15>
xor    %esi,%esi
mov    %esi,%edi
call   1030 <get_screen_offset@plt>
mov    %eax,%edi
call   1040 <set_cursor@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_screen_clr>:
push   %rbp
push   %r14
push   %rbx
xor    %ebx,%ebx
movzbl %dil,%r14d
nopw   0x0(%rax,%rax,1)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x20,%edi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %r14d,%ecx
call   1050 <print_char@plt>
add    $0x1,%ebp
cmp    $0x50,%ebp
jne    1150 <clear_screen_clr+0x20>
add    $0x1,%ebx
cmp    $0x19,%ebx
jne    1140 <clear_screen_clr+0x10>
xor    %edi,%edi
xor    %esi,%esi
call   1030 <get_screen_offset@plt>
mov    %eax,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <set_cursor@plt>

LLVM IR (-O0):
define void @clear_screen_clr(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
store i8 %0, i8* %2
store i32 0, i32* %3
br label %5
5: ; preds = %21, %1
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 25
br i1 %7, label %8, label %24
8: ; preds = %5
store i32 0, i32* %4
br label %9
9: ; preds = %17, %8
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 80
br i1 %11, label %12, label %20
12: ; preds = %9
%13 = load i32, i32* %4
%14 = load i32, i32* %3
%15 = load i8, i8* %2
%16 = call i32 @print_char(i8 signext 32, i32 %13, i32 %14, i8 zeroext %15)
br label %17
17: ; preds = %12
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
store i32 %19, i32* %4
br label %9
20: ; preds = %9
br label %21
21: ; preds = %20
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %5
24: ; preds = %5
%25 = call i32 @get_screen_offset(i32 0, i32 0)
%26 = call i32 @set_cursor(i32 %25)
ret void
}

LLVM IR (-O2):
define void @clear_screen_clr(i8 zeroext %0) {
br label %2
2: ; preds = %1, %9
%3 = phi i32 [ 0, %1 ], [ %10, %9 ]
br label %4
4: ; preds = %2, %4
%5 = phi i32 [ 0, %2 ], [ %7, %4 ]
%6 = tail call i32 @print_char(i8 signext 32, i32 %5, i32 %3, i8 zeroext %0)
%7 = add nuw nsw i32 %5, 1
%8 = icmp eq i32 %7, 80
br i1 %8, label %9, label %4
9: ; preds = %4
%10 = add nuw nsw i32 %3, 1
%11 = icmp eq i32 %10, 25
br i1 %11, label %12, label %2
12: ; preds = %9
%13 = tail call i32 @get_screen_offset(i32 0, i32 0)
%14 = tail call i32 @set_cursor(i32 %13)
ret void
}