#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*/ set_scrn_buf(int, int, char);
int /*<<< orphan*/ tty_print_region(int, int, int, int);
void popclear() {
  int i, j;
  char *pp;
  for (i = 8; i < 8 + 15; i++) {
    for (j = 16; j < 16 + 30; j++) {
      pp = (char *)(0xb8000 + (i * 160) + (j * 2));
      *pp = ' ';
      set_scrn_buf(i, j, ' ');
      pp++;
    }
  }
  tty_print_region(8, 16, 8 + 15, 16 + 30);
}


x86 assembly (clang, -O0):
<popclear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x8,-0x4(%rbp)
cmpl   $0x17,-0x4(%rbp)
jge    11a8 <popclear+0x88>
movl   $0x10,-0x8(%rbp)
cmpl   $0x2e,-0x8(%rbp)
jge    1195 <popclear+0x75>
imul   $0xa0,-0x4(%rbp),%eax
add    $0xb8000,%eax
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x20,(%rax)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x20,%edx
call   1040 <set_scrn_buf@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1140 <popclear+0x20>
jmp    119a <popclear+0x7a>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112f <popclear+0xf>
mov    $0x8,%edi
mov    $0x10,%esi
mov    $0x17,%edx
mov    $0x2e,%ecx
call   1030 <tty_print_region@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<popclear>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    $0x8,%r15d
mov    $0xb8520,%r14d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xffffffffffffffe2,%r12
mov    %r14,%rbx
nopw   0x0(%rax,%rax,1)
movb   $0x20,(%rbx)
lea    0x2e(%r12),%esi
mov    %r15d,%edi
mov    $0x20,%edx
call   1040 <set_scrn_buf@plt>
add    $0x2,%rbx
inc    %r12
jne    1150 <popclear+0x30>
add    $0x1,%r15
add    $0xa0,%r14
cmp    $0x17,%r15
jne    1140 <popclear+0x20>
mov    $0x8,%edi
mov    $0x10,%esi
mov    $0x17,%edx
mov    $0x2e,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <tty_print_region@plt>

LLVM IR (-O0):
define void @popclear() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
store i32 8, i32* %1
br label %4
4: ; preds = %30, %0
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 23
br i1 %6, label %7, label %33
7: ; preds = %4
store i32 16, i32* %2
br label %8
8: ; preds = %26, %7
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 46
br i1 %10, label %11, label %29
11: ; preds = %8
%12 = load i32, i32* %1
%13 = mul nsw i32 %12, 160
%14 = add nsw i32 753664, %13
%15 = load i32, i32* %2
%16 = mul nsw i32 %15, 2
%17 = add nsw i32 %14, %16
%18 = sext i32 %17 to i64
%19 = inttoptr i64 %18 to i8*
store i8* %19, i8** %3
%20 = load i8*, i8** %3
store i8 32, i8* %20
%21 = load i32, i32* %1
%22 = load i32, i32* %2
%23 = call i32 @set_scrn_buf(i32 %21, i32 %22, i8 signext 32)
%24 = load i8*, i8** %3
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %3
br label %26
26: ; preds = %11
%27 = load i32, i32* %2
%28 = add nsw i32 %27, 1
store i32 %28, i32* %2
br label %8
29: ; preds = %8
br label %30
30: ; preds = %29
%31 = load i32, i32* %1
%32 = add nsw i32 %31, 1
store i32 %32, i32* %1
br label %4
33: ; preds = %4
%34 = call i32 @tty_print_region(i32 8, i32 16, i32 23, i32 46)
ret void
}

LLVM IR (-O2):
define void @popclear() {
br label %1
1: ; preds = %0, %15
%2 = phi i64 [ 8, %0 ], [ %16, %15 ]
%3 = mul nuw nsw i64 %2, 160
%4 = add nuw nsw i64 %3, 753664
%5 = trunc i64 %2 to i32
br label %6
6: ; preds = %1, %6
%7 = phi i64 [ 16, %1 ], [ %13, %6 ]
%8 = shl nuw nsw i64 %7, 1
%9 = add nuw nsw i64 %4, %8
%10 = inttoptr i64 %9 to i8*
store i8 32, i8* %10
%11 = trunc i64 %7 to i32
%12 = tail call i32 @set_scrn_buf(i32 %5, i32 %11, i8 signext 32)
%13 = add nuw nsw i64 %7, 1
%14 = icmp eq i64 %13, 46
br i1 %14, label %15, label %6
15: ; preds = %6
%16 = add nuw nsw i64 %2, 1
%17 = icmp eq i64 %16, 23
br i1 %17, label %18, label %1
18: ; preds = %15
%19 = tail call i32 @tty_print_region(i32 8, i32 16, i32 23, i32 46)
ret void
}